Stars travel with very high speeds relative to us. This moves their spectral lines either in to the red, to longer wavelengths, if they are moving AWAY from us, or in to the blue, to shorter wavelengths, if they are moving towards us. An object moving towards is thus called, blueshifted and an object moving away from us is called, redshifted.
Most importantly, using the Doppler Effect, we can very accurately determine the precise velocity of a star relative to our motion, and along our line of site to that star (a few important caveats there!)
The first step requires identifying the lines at their ``rest'' wavelength:
The lines we expect from, say Hydrogen, will NOT be in their normal place if the star is moving quickly. However, ALL the lines move with the same relative shift:
If we can identify a specific relative pattern, like in this example, we see two close lines, separated by a third isolated line, this allows us to identify WHICH lines we are seeing.
By measuring the exact wavelength the lines are seen at, and comparing that with what we know the rest wavelength (stationary wavelength) is, we determine the relative velocity of a star.