Fan does not run, over-heats
Thank for contacting Fixya, I will be glad to assist you.
In such extreme situations like this, the very fact that you have taken your iMac in four times to either an Apple retail store or an Apple Authorized service provider and having those repairs/replacements performed still with no resolution, is a sign your iMac may actually need to be replaced.
From my experience as veteran Mac tech, if your computer has been repaired at least three (3) times and there is still no resolution to the issues it has been having, you should be able to get a replacement computer from Apple or one of its authorized service providers.
Given the extent of the repairs that have been performed, I would recommend you take this computer back to your local Apple store and find out what is needed to acquire a replacement iMac.
The main reason I am being so direct in this answer to you, is not only due to the number of repairs you have experienced on this computer, but also the fact that of those repairs/replacements, the iMac's main logicboard (i.e. "motherboard") was replaced, yet you are still experiencing issues with your iMac's fan not running and your is also still iMac overheating.
This is a genuine hardware issue for sure so this is the course I recommend you take. One additional point I also need to add however. I noticed you never mentioned that the Apple retail store or the Apple Authorized service provider checked, repaired or replaced the fan which stops running and causes your iMac to overheat.
That is one component you need to have checked by a Mac technician, only because if the fan is still not running, even after the main logic board has been replaced- that still constitutes the problem you are having is still relative to the hardware, not so much the software.
If you have more questions, please don't hesitate to reply back to this post.
Apple 20" iMac...
on Jul 19, 2012