I can tell you why the thing starts again after periods with no battery but not why it shuts down.
Resetting the Logic Board is how Apple describe it and it works on all of Apple's boards. Normally you would remove the PRAM battery/Backup Battery, disconnect the main power source, (Outlet or Battery) press the power on button and go for coffee. Come back in 20minutes, minimum. Every electronic component that is capable of holding a charge is now discharged. Plug everything back in. On startup the PMU, and other bits, are forced to reload whatever it is that they need. Voila, the machine usually boots right up.
I know that the early, clamshell, iMacs did not have a backup battery but I'm not sure about later ones. I check my manuals when I get back to the house. There are a few laptops that make no mention of one but infact do have one.
P
I have a G3 iBook 900 MHz which worked fine until a couple of months ago. I left it to sleep with the lid closed for a couple of days and when I picked it up again the battery was empty. I plugged it in and tried to boot but nothing happened. I waited until the battery was full, nothing. Tried booting with the battery removed, nothing.
I reset the PMU with battery and power supply removed, battery in place and all other combinations, no go.
I even took out the capacitor that looks like a PRAM battery from the motherboard (the most ultimate reset I could think of). When the power is plugged in there is power on the firewire port. There is also power on the logic board with the battery in place and/or the power supply plugged in.
It's not the power switch, it's not the sleep reed switch in the display.
Since the only solution seemed to be a logic board replacement (costing about 800 Euro's) I emptied the piggy bank and got myself a macbook.
Two weeks ago, as a last check before putting the parts on e-bay, I plugged in the power brick (battery was completely empty of course), pushed the power button and... it booted fine. My old friend was back!
It immediately started dowloading system updates so I left and went to sleep.
The following morning, alas, the screen was black and the iBook was off. Again pressing the power button did absolutely nothing. I took out the battery and left it for a week. Then I put the battery back in, and voila, iBook alive again. The system updates were not installed so it must have turned off before the downloads were complete. I suspected sleep mode was the cause so I set the computer to never go to sleep. I shut down the computer, waited a couple of minutes and turned it on again. Still no problem. Again I started the software update and again... after half an hour downloading it turned off while I was looking the other way. And of course it would not start anymore. I can understand why letting it rest for a while may decharge some capacitor so everything is reset. But why does it shut down after a while...
I suspected the PRAM battery only to find the iBook does not even have one...
I have nothing to loose but time, so if anybody knows of a part that may cause this failure I will grab the soldering iron and replace the part. (yes, I do have a lot of experience soldering electronics)
Any suggestion is welcome.

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic