The exhaust fan thermostat is usually the failed component. When it senses heat it turns on the exhaust fan. If you are cooking on the cooktop, it can sense the heat and the fan won't turn off until the thermostat cools.
On several models of microwaves the thermostat is super sensitive, causing the exhaust to run longer than needed. Replacing the thermostat didn't help much. Adding a washer under the thermostat allowed air to move around it, keeping it cooler, thus, the fan didn't run as long.
It is also common for this thermostat to fail causing the fan to constantly run.
The thermostat is a round disk with 2 terminals. It is a simple bimetal that warps to make or break contact. It is an inexpensive part $20-$50.
It is NOT an easy part to get to. The microwave has to be completely uninstalled and placed on a sturdy table. The cabinet needs to be removed. Then discharge the capacitor. If you don't know how to properly discharge a capacitor, I would suggest having it repaired by a certified/qualified technician.
==UNPLUGGED == A CAPACITOR CAN HOLD UP TO 4,000 VOLTS.
THAT CAN AND WILL KILL YOU...DEAD