The flame sensor is triggered when a light or heat is within a certain range. When the sensor is  triggered

the relay will flip and turn the fan on. The flame sensor is the red component shown in the picture to the right. The relay is the blue component shown in the picture to the right.

Demonstration