
Hydrogen as a chemical element was discovered by Henry Cavendish in 1766. However, its stellar role was first recognized by Cecilia Payne-Gaposchkin in 1925 — she showed that stars consist mostly of hydrogen. The spectral lines of hydrogen had been studied earlier by Johann Balmer in 1885.
The hydrogen spectrum is like a unique barcode. When electricity or heat excites the atom, the electron jumps to a higher 'floor', then falls back, emitting light of strictly defined colors. By these colors, astronomers can tell that a distant star contains hydrogen.