Nanoscale optical sensors work by utilizing the interaction of light with nanostructured materials. These interactions can lead to changes in the intensity, phase, polarization, or wavelength of light, which can be detected and analyzed. Key mechanisms include surface plasmon resonance (SPR), fluorescence, and Raman scattering.