They observe very closely using telescopes and also split the light into its constituent colors (or frequencies) using a device called a diffraction grating.
By noting the wavelength at which the radiation emitted by the star.
5.6m questions
7.3m answers