A photoelectric smoke detector works by using a light source and a sensor to detect smoke particles in the air. When smoke enters the detector, it scatters the light, which triggers the sensor to sound the alarm.