How does a spectroscope enable astronomers to determine the characteristics of distant stars and galaxies?
Around 1859 the German chemists Robert Wilhelm Bunsen and Gustav Robert Kirchhoff began to examine the light generated when elements were heated to incandescence. By passing that light through a prism and noting where a bright line occurred (emission spectra) they were able to map the characteristic light of each element. Such "fingerprinting" enabled them to build a library of each element's characteristic light, and compare that with the light of a given substance. Several unknown light mappings were discovered; these included the discovery of the elements cesium and rubidium. The spectroscope was also applied to the light of the Sun in 1862, where the Swedish astronomer Anders Jonas Angstrom identified hydrogen. In 1868, French astronomer Jules Cesar Janssen discovered a new element in the Sun through use of the spectroscope; it was named "helium" from the Greek "Helios", meaning sun. In time, a given star's radial velocity could be determined by observing its Red Shift, where the spectra of the atoms in the star would be shifted towards the red end. In the 20th century, these same techniques have been applied to observe the distance and recession rate of galaxies, and to observe the composition of atoms that comprise the stars in those distant galaxies.
"The New Intelligent Man's Guide to Science," I. Asimov, Basic Books, Inc., 1965, pg. 70.