So you look at a particular spectral line, something that should be occurring at a particular wavelength, and you should see how much it's blue shifted all red shifted to figure out how fast it's moving and by making some assumptions about how the things expanding you can then turn that speed into the third dimension in space, essentially because the further you are away from the star, the force that things are moving so If you see something moving very fast, it's probably a long way from the star.