Why do different elements in star spectrum have different frequencies or what? “Spectroscopy” is the science of gleaning information about something by looking at the spectrum of light it emits, or even absorbs. The spectrum of a perfectly black body is, not surprisingly, called the “black body spectrum”. The black body spectrum is also a very good approximation for the spectrum emitted by pretty much any thermal source. Really, everything we know about stuff outside of the solar system (everything beyond “look, stars!”) is based on spectroscopy.