I have an external monitor attached to my iMac. Sometimes I use it as a secondary display, sometimes it is turned off. When you are already in OSX and turn on your external monitor it will not be detected immediately. You first need to open your display preferences and click on “Detect Displays”. This tweet however, shows that you can use CMD + BrightnessUp (which is in most cases F2 or fn + F2) instead.