The modern picture of the atom is a compact nucleus, containing protons and neutrons, surrounded by a cloud of electrons. These electrons can only occupy specific energy states. If a photon with exactly the right amount of energy hits an atom, it can push an electron from a lower energy state to a higher energy state, or even knock the atom free of the nucleus entirely (a process called ionization.) Electrons naturally like to be in the lowest possible energy state, so if an electron is bumped into a higher (“excited”) energy state it will eventually spontaneously fall back to a lower energy state on its own. When it does, it will emit a photon equal to the energy difference between its starting state and its final state. We can see evidence of both steps of this process: if we are looking through cool gas with stars behind it, the gas will absorb the starlight as electrons in the atoms in the gas are excited, so we see dark lines in the spectrum from the star corresponding to these transitions. If, instead, we are looking at a bright object we will see the emission released when the electrons fall back down to lower energy states, so we will see bright lines at the points in the spectrum corresponding to these transitions.
Since the energy levels of different elements are different, if astronomers see a specific spectral line coming from a certain region, they can infer what elements are present there. One particularly important line is the hydrogen-alpha line at 656.28 nm. This is caused by the transition of an electron in a hydrogen atom from the third lowest energy state to the second lowest. This transition frequently results when an ionized hydrogen atom recombines (i.e. recaptures an electron to become neutral), so H-alpha emission is characteristic of regions of ionized hydrogen. The H-alpha emission from the entire sky has been mapped in great detail, revealing a wealth of structure in our galaxy.