The NES's GPU generates sync pulses on the video line - one at the end of each line to make the electron gun's aim to return to the left side, and a long one at the end of each frame for the electron beam path to return to the top left. Circuitry in the TV uses these pulses to keep the picture stable.
To answer more specifically: the NES doesn't know what the CRT is doing. It's the CRT's responsibility to sync itself to the incoming signal. So there's not bidirectional communication, but they are still synced.
They are synced up; in the NES, the PPU generates the video signal and is also attached to the CPU and provides interrupts at various points in the frame.
CRTs wouldn't work if the video device wasn't synced up, whether that's an NES or whatever, it has to know when to send what data. It's not like the TV has a buffer.
https://en.wikipedia.org/wiki/Analog_television