Sometimes my iMac won't sleep. I've tried closing various applications as well as logging out of my account before entering sleep mode, but I still hear it humming quietly when I come back minutes later. It happened to me last year with Snow Leopard but went away after a reboot. Lately, using OS X Lion 10.7.3, it's happening again.
If this is happening to your iMac or MacBook, try running
pmset, a command-line tool to manipulate power management settings. Open the Terminal app and type the following:
pmset -g assertions
Roughly translated, this reads get me a list of the power management assertions, or reasons the computer might not be able to enter sleep mode. The first time I ran this, I noticed the CUPS printing system was preventing sleep. The screenshot doesn't reflect that. I killed that process (you can use the Activity Monitor app to do this).
I noticed another assertion from the audio system. I did not kill that process as it was related to
PreventUserIdleSystemSleep. If you're listening to music, this shows up to keep you from having to touch your trackpad/keyboard to keep your system awake and playing.
I opened System Preferences > Energy Saver and restored defaults for good measure.