To understand this, we need a digression.
The Doppler Effect: Imagine that you are lying on the sofa, watching soaps. A fire engine comes down the street. While it's approaching you, the pitch of the siren is higher. While it's receding from you, the pitch of the siren is lower. If you could hear stars, they would do the same thing. The stars that are approaching you would have a higher pitch, and the ones that were going away from you would have a lower pitch.
Unfortunately, noise does not travel through space. Fortunately, the same effect also applies to light, if we just replace the word pitch with the word frequency.
The Doppler effect shifts the light's frequency, depending on whether the object is moving towards you or away from you. If the object moves towards you, it is catching up a little bit to the light as it is emitted, and the frequency gets higher. This is called "blue-shifting", and the light is bluer. If the object is moving away from you, the light gets stretched out, and the frequency gets lower. This is called "red-shifting", and the light is redder. The source in the following image is the yellow dot. It is moving to the left.
How can you tell the difference between an object which has been blue-shifted, and one that is hotter?
The answer is to use the 'lines' discussed above, which show what the star is made of. These have a particular pattern, and also a particular set of wavelengths when they are at rest. We look at the spectra of stars, and measure how much the lines have shifted.
The shift in frequency, the rest frequency and the velocity are all related:
(Change in Frequency) velocity
--------------------- = --------
(Rest Frequency) c
where c is the speed of light.
So. Finally. What did we just figure out? Oh right. The radial velocity, or the motion of the star towards or away from you. To figure this out, you need to know that an atom's signature lines get shifted when the object moves, and the amount of the shift is determined by the speed of the star.