Resistors serve several purposes, but before you get into that...

When you study electronics the first thing you learn is

Ohm's Law (Current =Voltage/Resistance).Resistors "resist" current flow. The higher the resistance, the lower the current (with a given voltage). With infinite resistance (and "open circuit") no current flows. With zero resistance (a "short circuit") 'unlimited" current flows unless there is some resistance elsewhere in series and "bad things" can happen with a short.

A wire has essentially zero resistance. Current flows freely through the wires in your house with essentially zero voltage drop

*across* the wires, so all of the voltage is delivered to the load (a light bulb, or hair drier, or whatever is plugged-in).

In house wiring, the resistance of the load determines the current. A light bulb has less resistance than a hair drier. If you short-out the power outlet with a wire, excess current flows and you blow a circuit breaker.

A turned-on light switch is a short-circuit in series with the light bulb. All of the voltage "appears" across the infinite resistance of the switch so there is no voltage across the load.

A turned-off light switch is an open circuit and no current can flow. Since the resistance is (nearly) zero, (nearly) no voltage is "dropped" across the switch and all of the voltage appears across the load.

There is a water-flow analogy where water-flow represents electrical current flow. Water pressure represents voltage. A skinny pipe represents high resistance and a fat pipe represents low resistance.

The difference is, if you cut a water pipe water flows out all over the place. If you cut a wire you get infinite resistance and no electrical current flows. And, generally nothing bad happens with zero water resistance (except maybe for a flood

).

P.S.

Resistors with LEDs are "unusual" because the resistance of the LED is non-linear... The resistance of an LED changes drastically with voltage. If you increase the voltage above the LED's operating voltage it's resistance drops. That means we can't

*directly* apply Ohm's Law to the LED.* But, we can apply Ohm's Law to the resistor to figure-out the current & voltages.

With a series resistor the voltage divides between the LED & resistor.** The voltage across the LED "magically falls into place" and the remaining voltage is dropped across the resistor. Now that we know the voltage across the resistor we can use Ohm's Law to calculate the resistance needed for the desired current through the LED & resistor.

* Ohm's Law is a law of nature (with man made units-of-measure) so it's always true and it's true for the LED. It's just hard to use because the resistance of the LED is unknown until we to know the current & voltage.

** The way that voltages & currents combine or divide in series & parallel circuits is described by

Kirchhoff's Laws.