iMac behaves inconsistently when waking from long periods of inactivity
This would be explained if your iMac was sometimes in what Apple calls Safe Sleep and others (and Apple internally) call hibernation mode and is expected and intended by Apple to save energy.


http://support.apple.com/kb/HT1757




You should be able to disable this if needed by using pmset on the command line. Unless you are comfortable with the terminal, you might just leave things as Apple has configured since the hibernation should only engage for longer sleep periods to save more energy than if the machine was kept sleeping lightly the entire time.