Hope this helps:
The rotating signal is fed into a calibrated phase shifter which is controlled by the OBS on the front of the instrument in the cockpit. It is turned until the two signals are in phase and the CDI is in the centre.
The TO-FROM indicator is driven by another phase shifter and phase detector operating in parallel. Because of the nature of VOR transmissions and the way they are used for direction finding, there is a 180° ambiguity, so the CDI is equally sensitive to signals coming from either of two opposite directions (i.e. two radials, 180° apart, from the same VOR). To resolve this an additional circuit indicates TO or FROM with a flag. The reference signal is shifted by another 90° and compared again to the rotating one, to tell whether it is leading or lagging the rotating signal, to make the indicator show the relevant direction.
Phil