Most LEDs will burn out if connected to a 9V battery without a resistor. The resistor lowers the amount of current flowing through the LED. To calculate how much resistance is needed, you can assume the average LED takes around 2V and 20mA (if you want to be more precise, look up by color, or to be exact, look at the LED’s datasheet). For these simple experiments, resistor values do not need to be exact (+-20% is fine), but if you calculate exactly you get the most brightness without losing efficiency, and also the best battery life.
If you wire more LEDs in series, or you use white or blue LEDs which require more power, you will need a lower resistor. Depending on your voltage source, there will be a limit to how many LEDs will work in series. You can also wire LEDs in parallel, where each one has their own resistor. Lastly, you can combine parallel strings of LEDs in series.
Read more here: http://www.robotroom.com/Pumpkin3.html (NOTE: in the breadboard photos there is power -red- on one side and ground -black- on the other, not next to each other like other, more expensive, breadboards.)