An atom is made of a nucleus and a number of electrons orbiting in shells around it. Electrons can be found in many discrete energy states, defined by quantum mechanics. The energy levels depend on the structure of the nucleus, so they vary from element to element. Electrons can gain or lose energy by absorbing or emitting a photon with the same energy as the difference between two allowable energy states. This is why different elements have unique spectrums and gives rise to the science of spectroscopy.