A star’s color tells us a lot about the star: its temperature and perhaps even the star’s life cycle. But to dig a bit deeper, scientists use a tool called the spectroscope and spectroscopy. In 1814, Joseph van Fraunhofer invented the modern spectroscope. The spectroscope basically uses a prism or diffraction grating to break light into its component colors, producing a spectrum. There is also a slit, where the light enters, and a telescope-like focuser.
The heart of the spectroscope — the component which breaks light into its component colors, is either a prism or a diffraction grating. Think of the diffraction grating as many small prisms on a thin sheet of plastic or glass; 500 or more rulings per inch. The CD is a good analogy to a diffraction grating.
A spectroscope can be mounted on a telescope, collecting light from one object, such as a star or galaxy, to be passed through the spectroscope for analysis. (1)