How do scientists know that there is redshift from a star going away and EM waves have changed lengths?
By comparing Spectrums.
This is done by obtaining spectrum of a distant object, stars, galaxies etc. and comparing the spectrum with the spectrum of our star the Sun or laboratory values. for example the spectrum shows a hydrogen absorption wavelength at 650 nm, if you compare it to the lab values or spectrum of our Sun, you will find different in wavelength. The hydrogen absorption wavelength in laboratory is at 656 nm which means that the Star or the object is coming towards us i.e. Blue shifted. The term Blue Shift simply means that the absorption wavelengths have shifted towards the Blue wavlength.