The resistor sets the current. With a 5 V supply and a red LED that drops about 2 V:
I = (5 V − 2 V) ÷ 330 Ω ≈ 9.1 mA
That is bright enough to see clearly and well under the 20 mA most small LEDs are rated for. A blue or white LED drops about 3 V, so the same resistor gives (5 − 3) ÷ 330 ≈ 6 mA, a little dimmer. The resistor can go on either side of the LED; what matters is that the LED's anode (longer leg) faces the positive side.