It could be a number of problems.
Test your PSU power supply unit or replace it if your power supply units fan is not working your PSU is faulty
Testing and replacing the PC power supply
One bad lead can cause a computer to continue on a cycle of restarting or to shutdown or fail to detect ,boot up a computer hard drive
WARNINGBefore you start troubleshooting remember that you are dealing with electricity that can KILL.
http://www.kitchentablecomputers.com/static.php - rules
Only work inside the computer case when the power has been switched off and disconnected. Never open the power source.
Some of the below steps recommend removing physical parts within the computer.
While in the computer it is highly recommend that you be aware of ESD and its potential hazards
Test all leads that attach to your hard drive power and data cables IDE ,SATA
the leads from yourMOTHERBOARD TO YOUR HARD DRIVEmake sure they have a secure dust free connections and are not faulty or just replace them they could be faulty
Make sure all leads that are attached to your dvd \ cd floppy drives have secure connections and are not faulty or just replace them they could be faulty.
Computers need power and data to travel through every working device to continue its cycle and have an end so any faulty leads will end up with a computer error.
Even something as small as a faulty electrical or fan lead can cause you problems
Motherboard and a Hard Drive any leads between them will fail before your motherboard or your hard drive if its a flat ribbon 40 pin type IDE replace it this will be the first to fail.
Check all electrical power input and extensions make sure they are securely seated even the cd/dvd floppy drives need to have current go through make sure these drives are working
also check the Cmos battery and computer RAM modules make sure they are securely seated with no dust built up or in the sockets on some motherboards cmos batteries are soldered in.
If you find you need more help with this post a reply.