MacBooks engage “sleep” mode by default whenever the lid is closed. This is done in spite of any energy saver preferences you set within MacOS. Having an external display, keyboard, or mouse can prevent the sleep mode from engaging so that the computer instead enters “clamshell” mode. Clamshell mode allows the computer to keep running even while it's closed.

How Sleep Mode Works

You can choose to enter sleep mode by either closing the lid or selecting the option from the Apple menu. In this mode, any non-essential power-consuming components are shut down. These include any optical drives, the audio-visual ports, network ports and more. When in this mode for three hours or more, the computer transitions into standby mode. Standby mode is different from sleep, in that it saves an image of your computer to the hard drive and shuts down more components. The MacBook wakes from both modes in the same way.