Voltage power supply - Forward Voltage of LED (or sum of forward voltages) = Current x Resistance.
So if you have a single RED led with a forward voltage of approximately 2v and you want 10mA (0.01A) of current with a 12v power supply, then :
12v - 2v = 0.01 x R ====> R = (12-2) / 0.01 = 10 x 100 = 1000 ohm
Another example, if you have 3 blue leds in series, which have a forward voltage of 3v each, and you want 20mA to go through them :
12v (power supply voltage) - 3 leds x 3v (forward voltage of each led) = 0.02 A (20mA current) x R ====> R = (12 - 9) / 0.02 = 150 ohm
Also, power dissipated in a resistor can be calculated with formula P = IxIxR where I is current and R is resistance.
So for example, with the 150 ohm resistor above, you have P = 0.02A x 0.02A x 150 = 0.06 watts, which means you can use a resistor rated for 0.125 watts.
You typically want to stay below 75% of the resistor's power rating, for safety and reliability reasons and keep the resistor within acceptable temperatures. If the power dissipated was close to 0.1w, it's better to use a resistor rated for 0.25w