A few days ago I posted about hooking up a 27 inch Dell monitor in my office at work. Marcin posted a comment asking how I was able to use my MacBook Pro while the lid was closed. I responded that it just worked. Since then, I have hooked and unhooked my MacBook Pro a dozen times or so with the lid closed and have had mixed results. I did some searching today to see if there is a set of steps you can follow to keep from having issues - the issues being the laptop doesn't wake up after plugging in the external display and/or unplugging it.
Sure enough, there is a set of specific steps which you can read about on Apple's site.













I have not used this, but ran across the link when researching the same issue.
Plugging in:
The MacBook must be closed and 'sleeping'.
Plug in external power
Plug in Monitor & turn on
Plug in peripherals (turn on wireless keyboard)
- Mac usually awakens prompting for my login (the screen goes blue at first then black and sometimes has a lot of garbage/artifacts on the screen until I log in)
Unplugging:
Open MacBook's screen
Unplug the monitor connection and the mac's screen should come on and return to it's normal function.
After its back to normal, I remove and turn off my mouse/keyboard, power, cat5.
Once disconnected, I close the lid on the macbook, and while it's prepping for sleep, I pack up everything I'm taking with me.
Once its sleeping, slide it in the bag and go home, you've been working too hard.