Every now and then we hear about people who are having power problems with their Macs. The system either will not turn on, or more often will suddenly power off. At times this has happened to batches of Macs, but mostly it is a sporadic occurrence. There can be several reasons why Macs will suddenly power off.
Overloaded or Faulty Home Circuits
One commonly overlooked aspect of the computer's power is it's original source. If your house or wall sockets are overloaded with other devices and appliances, you may be overloading the circuit. This can cause fluctuations in current that can cause the power supply in your computer to fail. Homes electrical circuits are usually set up for separate circuits for appliances, lighting, and open sockets, but check the circuit breaker diagram to see which circuits are being used more than others. Optionally, you can just try plugging your system into another room in the house.
If your house is not wired correctly, either by poorly insulated connections, improper grounding, or other connection faults, you may have noisy circuits that can stress the power supply of your computer and cause premature failing. It also can cause more fluctuations in line current and voltage, leading to similar behavior as an overloaded circuit. Again, try changing circuits to see if this helps.
In both cases, you may benefit from using a battery backup for your system. Battery backups will use a battery to smooth out line noise and provide an opportunity to shut down the computer safely in the event of a power outage. In addition, many current models have line diagnostics that show when brownouts, blackouts, and increased line noise are present in your wall circuits.
Power Supply Failing
Another reason for a computer shutting off is if the power supply is failing. A faulty capacitor or other electrical component could be overloading and causing the supply to fail. While this usually would happen during higher computer usage where more wattage is drawn from the power supply, faulty components can also make the power supply more sensitive to the normal and expected wall voltage fluctuations.
If your power supply is failing, you will likely need to have it replaced at an Apple store. The exception is if you have a Mac Mini or other system that has an external power supply, you can purchase a replacement and plug it in yourself.
Lastly and more rarely, a fault in the power controllers on your motherboard may be causing the issue. Try resetting the PRAM and SMC (PMU on older PowerPC Macs--do a search for "PMU" along with your computer mode for specific instructions) and see if that helps. Alternatively, you may have a bad motherboard battery, which in part helps the computer store power settings. Additionally, other motherboard components may be faulty, which could result in similar behavior. If resetting the PRAM or CPU do not work, then again you will need to take it in for servicing so the battery and motherboard can be tested.