How to make this shader code work propertly?
gl_FragColor = sum / pow((amount + 1) * 2, 2);


This scaling factor isn't correct. Each loop executes amount * 2 + 1 times, not (amount + 1) * 2 times. So it should be:

gl_FragColor = sum / pow(amount * 2 + 1, 2);


Which for amount set to 0 gives a scaling factor of 1.