First, verify the fan on the power supply is working by examining the back of the computer.
Check if the fan is moving in general, as well as moving fast and smoothly (e.g., not wobbling or scraping against the insides of the power supply).
If you have recently attempted to add a new hardware device, remove that device to make sure it is not causing your issues.
Make sure you are not encountering any hardware conflicts by viewing Device Manager for errors. If you have recently installed new hardware drivers, you may want to try an earlier version of those drivers.
For all other fans in the computer, you need to open the computer and verify all fans are working (e.g., processor fan, video card fan, and case fans).
A temperature gun, like the one shown in the picture, can also be used to help gauge how hot the hardware components or integrated circuits are inside the computer.
Below are the steps on how this feature can be disabled and enabled in Windows XP, Vista, 7, 8, and 10.
Any failing hardware component in your computer could cause your computer to unexpectedly generate an error or reboot without warning.
If this is a laptop computer, there is also a fan located on one of the sides of the laptop that can be checked.
Make sure this fan is blowing air out of the laptop and check if you can feel hot air coming from the laptop.