Spectral lines originate under a variety of circumstances in Astronomy. The most ubiquitous element in the Universe, the Hydrogen atom, gives rise to the 21-cm-line ( 1420.405 MHz) due to a transition between the hyperfine levels of its ground state. If the Hydrogen atom is ionized, subsequent recombinations of electrons and protons lead to a series of recombination lines of the Hydrogen atom. It is easy to see that such transitions between higher Rydberg levels give rise to spectral lines at radio wavelengths. Transitions around Rydberg levels of 280, for e.g., give rise to recombination lines at 300 MHz. In cold (kinetic temperature 100 K), and dense ( 1000 cm) environments Hydrogen atoms form molecules. The CO molecule which has been used as a tracer of molecular Hydrogen has a rotational transition at 115 GHz. These are a few illustrative examples.
The widths of spectral lines arise due to different mechanisms. One such is the Doppler effect. The particles in a gas have random motions corresponding to the kinetic temperature of the gas. The observed frequency of the line is thus different from the rest frequency emitted by the particles. In a collision-dominated system, the number density of particles as a function of velocity is expected to be a Maxwellian distribution. The width of this distribution will result in a corresponding broadening of the observed spectral line due to Doppler Effect. This width, arising due to the temperature of the gas, is called thermal broadening. In addition to the thermal motion of the particles, there can also be turbulent velocities associated with macroscopic gas motions. These motions are often accounted for by an effective Doppler width, which includes both thermal and turbulent broadening, assuming a gaussian distribution for the turbulent velocities also. Another mechanism which can contribute to the line width is pressure broadening. This arises due to collisions and is particularly relevant in high density environments and/or for lines arising through transitions between high Rydberg levels. In addition, there is always a natural width to the spectral line imposed by the uncertainty principle, but it is almost always overwhelmed by that due to the mechanisms mentioned earlier.
An observed spectral feature can be much wider than that expected on the basis of the above mentioned mechanisms. This is usually due to systematic motion of the gas responsible for the spectral feature like, for e.g., rotation of a gas cloud, expansion of a gas cloud, differential rotation of a galaxy, etc..