I am not trying to teach granny to suck eggs, I have just seen so many " what value resistor " postings, and might have missed some good explanations in all the search results ....
Newbies to the hardwired side of micros seem to get confused about connecting LEDs to the Arduino pins, heres a little simplified basic understanding.
If you look at a LEDs spec, it will state the Vf or forward voltage at a current that the LED is happy with without burning out.
The forward voltage is different for various colour LEDs ( to do with the chemicals used in construction )
Once you apply more than the Vf to the LED, it will try and drag the supplied voltage down to its forward voltage ( like a zener diode ).
If you are trying to supply 5 volts to a 2 volt Vf LED directly from the Arduino pin, the LED will drag the Arduino pin down towards 2 volts, pulling more current until the internal resistance of the LED , the wiring, and the internal chip resistance between them lose the other 3 volts by generating heat.
Everything is now running towards meltdown, we have seen postings saying that people have connected an LED directly between the Arduino pin and ground and it works , sometimes it does for a while, but both the Arduino and the LED are running way over spec.
The right way to do it is to put a resistor in series with the LED, the Arduino happily supplies 5 volts out, the LED takes its 2 volts, and the resistor is happy to get rid of the other 3 volts.
The beauty is that we can now easily set the current through the LED to its recommended milliamps by Ohms law ( because the same current is passing through the LED and the resistor in series )
So if our particular 2 volt Vf LED is only supposed to handle 20 mA, then the resistor has to drop 3 volts at 20 mA ( 0.02A ) .
Ohms law tells us Resistance = Voltage / Current, so we would need a 3 / 0.02 Ohm resistor = 150 Ohms - which just happens to be an available value.
( If the value is an odd value, rather take the next available value higher and lose a little current rather than overun the led specs . )
You can substitute other values of Vf in the above for different LEDs.
A couple of points :-
Multiply the Vf by the number of LEDs in series ( you will probably need more volts than the Arduino can supply so will need a buffer ( a transistor or ULN2003 type chip - do a search )
You will be extremely lucky to put 2 LEDs in parallel and get the same light from each, as the Vf varies slightly from batch to batch, so each LED ( or string of LEDs in series ) needs its own resistor. ( unless you are using a constant current generator driver )
If you are using a 7 segment display, [and you are not multiplexing the segments, that is, all segments may be driven on together], you cannot have a single resistor in the common anode or cathode connection and expect a steady brightness for each displayed number , as the resistor would drop a different voltage depending on how many segments are lit ( one segment for "1" , 3 segments for "7" and all 7 for "8" )