If you want to learn all the technical details of how an LED and resistor work together, have a look at the Wikipedia page.
If you just want to know which resistor to use, then try the LED Resistor Calculator.
If you don't know the forward voltage or the optimal current for your LEDs, and you are feeling daring, then try using the some reasonable guesses. Lets say 1.9V for the forward voltage, and 20mA of current. This gives the following resistors :
- 5 volt supply : 180 ohm
- 9 volt supply : 390 ohm
- 12 volt supply : 560 ohm
If the LED is very bright, whip it out quickly - the resistor is too low! If the LED is faint, then try a smaller resistor. If you do use this method, its better to be safe than sorry - i.e. stick with as high a value resistor as possible, and don't be tempted to use a smaller value, even if that does make your LED shine brighter. If you use a resistor of too low value, then your LED will overheat and/or break. You could also damage your power supply. You have been warned!