It sounds very much like the "system fan" in your machine is the CPU cooling fan, as others have suggested. And it sounds like its bearings have worn out so the fan sometimes works (maybe at slower speed than intended) and sometimes just stalls. A fan in this condition may fail to start up reliably at boot time but then start a bit later. Or, it may actually stall after running for a while when its bearings heat up. In either case, you MUST replace this fan!
Now, your machine MAY work OK once the fan is replaced, maybe not. The hope is based on this: there are probably two protection systems for your CPU chip against overheating. The first is ALWAYS there in every system. The BIOS monitors the actual temperature inside the CPU from a sensor built into the chip; if it goes high, the BOIS either slows down the whole system to let the chip cool or, if that is not enough, it will shut down the system. Of course this means that, after it has been off for a while and the CPU temp is cooled off, it will re-start normally. BUT the original cause of overheating is still there, so it's very UNWISE to do this now.
Many mobos also have a second protection, and maybe yours has this. It monitors the speed signal being sent from the CPU cooling fan to the mobo. If that signal fails it indicates that the fan has stopped. (Note that this could happen if the fan really does fail, OR simply if the fan's speed signal fails to get to the mobo because there is a bad connection where the fan plugs into the mobo port.) If the mobo senses that the CPU fan has failed, it sends out a warning and usually completely shuts down the system within a short time. It does not even wait for the CPU temperature to rise. This is a pre-emptive way to prevent CPU overheating. If this is what has happened, the next time you try to turn on the machine it could go two ways. If the fan has failed and it does not start up (or even if the signal merely does not get through), the system will warn you again about the system fan failure and will not start. But if the fan does start up the system will work. THEN you have the worry - when will it fail again?
Bottom line: when you get dire warnings, pay attention! A failed system fan (CPU cooler) MUST be fixed before you do anything else. Ignoring that problem leaves you very vulnerable to CPU overheating and permanent damage, even though the system tries to protect itself against this. In your case, do not start up the system again until you replace the fan. Hopefully there was no permanent damage, and your system will work again when you have good CPU cooling.