To answer we need to examine the I-V relationships of both the resistor and LED.
The resistor is easy as it has a linear I-V relationship:

So we know that the current is always linearly proportional to the voltage applied - if the current is 1mA at 1V, we know it will be 2mA at 2V and so on.
The diode is a bit more complicated, here is the I-V curve:

The relationship is exponential rather than linear - here is the "ideal" Shockley equation from Wiki:
Shockley diode equation
The Shockley ideal diode equation or the diode law (named after transistor co-inventor William Bradford Shockley, not to be confused with tetrode inventor Walter H. Schottky) gives the I–V characteristic of an ideal diode in either forward or reverse bias (or no bias). The equation is:

where I is the diode current, IS is the reverse bias saturation
current (or scale current), VD is the voltage across the diode, VT is
the thermal voltage, and n is the ideality factor, also known as the
quality factor or sometimes emission coefficient. The ideality factor
n varies from 1 to 2 depending on the fabrication process and semiconductor material and > in many cases is assumed to be approximately equal to 1 (thus the notation n is omitted).
So what does this mean? It means at a certain voltage, the current will rise sharply (or we can see it as the resistance drops sharply) effectively "clamping" the voltage to a certain point (the physics is beyond the scope here, but worth reading about or asking on the physics stack) This point is dependent on the diode type, but will be around 1.8V for a typical red LED.
So if we have a resistor in series with a red LED, and we want to limit the current to 20mA (common operational current) we trace the I-V point on the curve. On the curve above we see that at 20mA the voltage drop is approximately 1.8V for the red LED, so we subtract this from the supply voltage and use Ohms law to calculate the resistor needed:

SO for a red LED running at 20mA from a 5V supply the equation is:
(5V - 1.8V) / 0.02A = 160 ohms.
Hopefully this clarifies things a bit.