Wavefront sensors work by detecting deviations in the phase of a light wave as it passes through or reflects off an object. One of the most commonly used types is the Shack-Hartmann wavefront sensor, which uses a lenslet array to break the incoming wavefront into smaller segments. Each segment focuses on a detector, allowing the system to calculate the local tilt and curvature of the wavefront.