Apparently the iMac G5s of a certain generation were outfitted with bad capacitors, either going bad on the logic board or the power supply. This hand-me-down computer would shut itself off intermittently and have a really hard time waking back up. Eventually it got worse and worse until I decided to try to fix it. With some online advice and info I identified some bad caps on my power supply and went about ordering a new one. iFixit had a clean and easy to navigate website and offered a warranty on their parts, so I went with them.
When I got the new power supply I realized that I had accidentally ordered the 20" power supply instead of the 17" one I needed! ARRGH! Luckily the iFixit guy on the phone got me set straight and my proper part arrived hassle free a few days later.
Ok, now for the repair... Easy. Switch out old power supply, insert new one, test run... Done!
Runs like a dream and this awesome machine is back from the dead.
iMac g5s are notorious for having this issue, there even was a recall that expired in 2008. If you open up the back and see blown capacitors in the power supply, replacing it with a new one ($150 or so with shipping costs) will almost certainly fix a failing machine. Did for me.