How CRT allows use of ligh-guns or pens etc?
The quintessential example of a light gun is Duck Hunt with the NES Zapper.

When the trigger was pressed, the Nintendo would trigger a special frame at CRT refresh rates. The screen would draw a white square at the target, too fast for human vision to see, but slow enough that a brightness sensor (A simple Phototransistor) with a very narrow field of vision in the Zapper could tell the difference between Black (miss) and White (hit). Multiple targets have their own target frame (or slightly overlapping).

  

The Zapper is the sensor in both meaning of the word. It senses the trigger press, and it senses the screen brightness. 

It didn't work on newer TV technology because the Zapper was designed to work with the precision refresh and scan rates of CRTs. Newer technology threw scanning away and don't have precision refresh rates. Newer light gun technology was created to adjust to newer TV technology. But at this point, check the wiki article for more information.