Spectral lines are the result of interaction between a quantum system (usually atoms, but sometimes molecules or atomic nuclei) and single photons. When a photon has exactly the right energy to allow a change in the energy state of the system (in the case of an atom this is usually an electron changing orbitals), the photon is absorbed. Then it will be spontaneously re-emitted, either in the same frequency as the original or in a cascade, where the sum of the energies of the photons emitted will be the same as the energy of the one absorbed. The direction of the new photons will not be related to the direction of travel of the original photon.
Depending on the geometry of the gas, the photon source and the observer, either an emission line or an absorption line will be produced. If the gas is between the photon source and the observer, a decrease in the intensity of light in the frequency of the incident photon will be seen, as the reemitted photons will mostly be in directions different from the original one. This will be an absorption line. If the observer sees the gas, but not the original photon source, then the observer will see only the photons reemitted in a narrow frequency range. This will be an emission line.
Absorption and emission lines are highly atom-specific, and can be used to easily identify the chemical composition of any medium capable of letting light pass through it (typically gas is used). Several elements were discovered by spectroscopic means -- helium, thallium, cerium, etc. Spectral lines also depend on the physical conditions of the gas, so they are widely used to determine the chemical composition of stars and other celestial bodies that cannot be analyzed by other means, as well as their physical conditions such as temperature.
Isomer shift is the displacement of an absorption line due to the absorbing nuclei having different s-electron densities from that of the emitting nuclei.
Mechanisms other than atom-photon interaction can produce spectral lines. Depending on the exact physical interaction (with molecules, single particles, etc.) the frequency of the involved photons will vary widely, and lines can be observed across all the electromagnetic spectrum, from radio waves to gamma rays.
Astronomers can use the light of a star filtered through the atmosphere of a planet to infer the chemical composition of the planet to determine if conditions for life are possible there.
|Excerpted and adapted from: Spectral line, Hubble Measures Atmosphere on World Around Another Star|