The fan should be running if the computer is hot, regardless of whether the screen is on. The more important causes will be the CPU, the hard drive, and the optical drive, as well as what programmes (if any) you have running. Ripping music or DVDs, for example, produces a lot of heat. You should check that there is good airflow around the case, with nothing blocking the slots on the bottom and top. Check also for dust buildup. If you have an iMac that is pre-isight, they are easy to open and check for dust.