When an ambulance drives away from you it has a lower pitch than when it is stationary. The faster the ambulance drives away from you the lower the pitch of it's siren will be. This is called the Doppler effect and it occurs with light too. When a galaxy moves away from us, it's light is shifted towards the red part of the spectrum, we call this redshift. Since all galaxies have abundant hydrogen, we can compare the wavelength of their hydrogen emission lines (red shifted light) with the same hydrogen emission lines that we have found in the lab to determine the change in wavelength between the emission lines, and hence determine the speed the galaxy is receding from us. We can then use the following equation to find that speed: v=c*(change in wavelength/wavelength in lab), where v is the speed the galaxy is receding from us and c is the speed of light.