Photo of the fan shroud temperature sensor/thermal switch that turns on the aux fan that's in front of the radiator (the one that comes on with AC)
It mounts in/on the upper right corner of the mechanical/belt driven fan shroud.
Testing can be accomplished by using a heat gun or the like and applying it the flat metal face. When it gets warm enough, the fan will kick on, then as the sensor cools the fan will shut off automatically.
The key need not be on, and it it actually this device that causes the fan to run for a bit after the engine is shut off.
NOTE: This is schematic diagram item #7 in post #76 of this FAQ designated as 'fan after run heat sensor'
Pic curtesy of RDWizard: