it is all very simple. There is a device that compares the rising edges of two different signals, and outputs an analog voltage that is proportional to the time difference between the two leading edge events. That analog voltage is used to tune the phase of a controlled oscillator either up or down.
You then use digital dividers to make the reference clock frequency equal to the oscillator to be controlled frequency at the input to that device.
when you turn it all on, the system tunes the oscilator until those two leading edges coincide.