The LM386 is similar to an opamp with an internal negative feedback path controlling gain.
Connecting a resistor across pins 1 & 8 (or a short circuit) changes part of the negative feedback path and alters the gain.
The output 250 uF is specified to have a low impedance at the lowest frequency of interest compared to the speaker. This ensures that most of the load voltage drop across the speaker and that the frequency response is not overly affected by capacitive reactance. Zc = 1/(2.Pi.f.C) at say 100 Hz Zc = 1/(2 x 3.14 x 100 x 250E-6) ~~= 6 Ohms. That's high relative to an 8 ohm speaker.
At 300 Hz Zc = about 2 Ohms.
Don't expect HiFi with that value.
The bypass capacitor needs to be low impedance at frequencies of interest compared to the 15K internal resistor (R1 in diagram below) that it is bypassing.
See datasheet here
See section 220.127.116.11 for design and the schematic on page 1 for what's inside.
Gain = 2 x R4 / (R3+R2)
As supplied = 2 x 15k/(150+1.35k) = 20
Short pins 1 to pin 8 = 2 x 15k/150 = 200
Connect a resistor from pin 1 to pin 8 parallels it across R3 and makes 150 < R2 + R3 effective < 1k5
making gain somewhere between 2 and 200