The cross correlation function is explained in the link in reply #17, and in countless tutorials on the web.
In the image below, there is a maximum in Rxy(tau) when the time (phase) shift tau0 is correct.