According to Bohr's model of the atom, electrons in atoms are found in specific energy levels. These energy levels are called stationary states, an electrons does not radiate energy when it occupies any of these stationary states.
However, an electron may absorb energy and move from one energy level or stationary state to another. The energy difference between the two energy levels must correspond to the energy of the photon of light absorbed in order to make the transition possible.
Since electrons are generally unstable in excited states, the electron quickly jumps back to ground states and emits the excess energy absorbed. The frequency or wavelength of the emitted photon can now be measured and used to characterize the transition. This is the principle behind many spectrometric and spectrophotometric methods.