Nanosensors have hundreds of operating principles. It has been, and still is, a major development axis of microelectronics in the past two decades.
They are generally made by improved semiconductor processes, to be small and to integrate some electronics for measurement and signal conditioning.
Their conversion methods are extremely diverse. The oldest ones used the big piezoresistive effect in semiconductors to measure the deformation produced by pressure on a membrane, acceleration on a beam... Capacitors produced with a variable spacing around 1µm can also detect minute displacements.
Nearer to chemistry, sniffers have been produced that catch specific molecules from the air on their surface, which changes some electric parameter which is then easy to detect.
And so on, and so forth.