Astronomers determine the velocity of distant stars by measuring the redshift of their light, which involves analyzing the star's spectrum. Each element emits a unique pattern of spectral lines, known as a "fingerprint," that can be shifted due to the Doppler effect. By comparing the observed positions of these lines to their expected positions, astronomers can identify the extent of the redshift. For example, if hydrogen lines appear closer to the red end of the spectrum, it indicates that the light has been redshifted. This measurement allows astronomers to calculate the star's velocity relative to Earth.