I always thought it was hilariously similar to how to old NES zapper worked - the sensor was in the gun, it decided what you ‘hit’ based on what the sensor saw when the tv flashed. I think it was an early instance of me recognizing an engineering ‘hack’ - instead of the target reporting whether it had been hit, it was the gun reporting whether it thought it had hit the target.
the "sensor" is actually in the remote. The bar is just two infrared leds seperated by a known distance, that the infrared camera in the remote uses to figure out it's position.
I play a bit of flightsim and our head tracking works the same way. Camera receives IR LED position for head movement axis, program does the interpretation of movement.
There's a homebrew head tracking demo [0] for the wii that has you put a sensor bar on your head, and a wiimote on top of your TV. I messed around with it over a decade ago and found it very convincing.