The electrons, negatively charged particles, in an atom “want” to be at their ground state: the lowest level of energy possible for them, kind of like you hanging out on your couch reading blog posts. However, like you, the electrons can get more energy, or be excited, by things they eat. .
Okay, so I know electrons don’t eat the way we do, but they do absorb energy from certain things around them. For example, if you pass electricity through a gas like neon gas, some of the energy will be absorbed by the electrons. When this happens the electrons can jump to higher energy levels.
Think for a moment about climbing a set of stairs. You can stop on any one of the stairs, you may even be able to take the stairs two or three at a time, but you can’t stop and stand halfway between two steps. The same is true for electrons. If they absorb enough energy they can jump up one or more steps; but they can’t stop in between. If they don’t get enough energy to make it up the complete step they won’t move at all. It’s an all or nothing deal.
So the excited electrons have jumped up one or more energy levels, but they aren’t very stable there. Consequently, they will fall back to their ground state. But, to get back to the couch they need to lose the extra energy they gained. And they do that by emitting electromagnetic radiation, or light. Remember though, that it was a specific amount of energy that each electron absorbed and is therefore emitting. Since different wavelengths of light have different energies, the electrons emit specific wavelengths as they drop down to their couch level of energy. This is what is called the emission spectrum. The emission spectrum is unique for each type of atoms. In other words, carbon, sodium, helium, and neon all emit different combinations of visible light.
Emission spectra and their related graphs showing the intensity of different wavelengths can be used to identify different materials and are useful in studying the composition a different astronomical objects like our sun.