Temperature Sensing
Here is a simple circuit with temperature-sensing to protect an N-Channel MOSFET. The comparator is set to limit the MOSFET from exceeding the safe operating temperature.

During normal operation a PWM signal is driving the Gate of the MOSFET, which in turn provides a path to GND for the electric motor. The comparator has an open-collector output and the voltage divider on the non-inverting input of the comparator is set to 2V. Here's how it works.
When the MOSFET is switching large amounts of current , heat develops and dissipates across the heatsink. A 10k Thermistor is used to sense the temperature on the heatsink. This type of thermistor is an NTC (Negative Temperature Coefficient) which means as the "temperature goes up, the resistance goes down." At 60C the value of the thermistor is 5k.
Let's say the thermistor detects 60C on the heatsink, using the voltage divider network equation...
Vo = (Vi*R) / (Rtherm + R)
= (12V * 1k) / (5k + 1k)
= 2V
Since the reference voltage on the non-inverting side of the comparator is set to 2V and the voltage measured across the 1k resistor is 2V, the output of the comparator will start to pull the Gate of the MOSFET to GND limiting the temperature.
More to come...