An emission spectrum is the result of electrons being excited or 'boosted' from one energy level to another. As they fall back down to their original energy level, they release a photon of light with a frequency corresponding to the energy difference. This releases certain colours of light which is what you see through a spectroscope.
An absorption spectrum occurs when a light source (e.g. a star) shines through the sample (say, a planet's atmosphere) and the atoms of the sample absorb photons with frequencies corresponding to their possibly energy level differences. This accounts for the black lines you see through a spectroscope. This absorbed energy excites electrons to a higher energy level corresponding to the frequency of the photon.
So far, so good.
What I don't get is why the electrons don't return to their ground state after being excited, releasing a photon with the same frequency as that which was absorbed - in other words, surely the atoms should absorb and emit exactly the same colours of light, and surely there should be no black lines seen through a spectroscope?
My chemistry teacher couldn't answer this, I hope someone here can.