Why is it necessary to put resistors before ground?

I want to know WHY it doesn’t matter

Largely because the speed of current in an electrical circuit is VERY fast. It's not quite c (the speed of light in a vacuum) but it's approaching that. Which means that if you imagine your 5V charge careering down the wire and into the LED, then yes if it stayed like that for any length of time it would damage the LED.

But then within an uncountably tiny period of time that 5V current exits the LED and careers into the resistor, which reduces the current in that entire section of circuit (between the 5V source and the 0V ground). And so your LED is protected.

For completeness it's worth noting that the actual speed of any individual electron travelling along the wire is actually quite slow, but it's the speed of the transmission of the electrical charge that we're interested in.

/r/arduino Thread Parent Link - i.redd.it