Emission Line Spectra
Unlike a continuous spectrum source, which can have any energy it wants (all you have to do is change the temperature), the electron clouds surrounding the nuclei of atoms can have only very specific energies dictated by quantum mechanics. Each element on the periodic table has its own set of possible energy levels, and with few exceptions the levels are distinct and identifiable.
Atoms will also tend to settle to the lowest energy level (in spectroscopist’s lingo, this is called the ground state). This means that an excited atom in a higher energy level must `dump’ some energy. The way an atom `dumps’ that energy is by emitting a wave of light with that exact energy.
In the diagram below, a hydrogen atom drops from the 2nd energy level to the 1st, giving off a wave of light with an energy equal to the difference of energy between levels 2 and 1. This energy corresponds to a specific color, or wavelength of light — and thus we see a bright line at that exact wavelength!