Occupancy sensors work by detecting human presence or activity. The specific answer is that occupancy sensors use one or more of three different technologies to detect or "sense" human presence and/or activity.
The most common technology is passive infrared (PIR).