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.
9.4m questions
12.2m answers