iMac G5 sleep / wake up problem
I have had exactly the same problem with an iMac G5 which arrived today. It could not be put into sleep mode manually (by selecting sleep from the Apple menu, or any other way), but would go to sleep automatically after a period and then could not be woken. Only solution was to hold in powerkey to reboot.
I reported this to apple support and turns out it's a hardware problem, so they're sending a new machine!
If you've only just got your machine give them a call and hopefully they'll arrange for a replacement. Otherwise you may have to open the box and replace the power management unit.