Sleep mode powers down everything except for a mere trickle of power to RAM, where your active state is preserved. Your computer’s RAM requires an ongoing current of electricity or else it will reset.
When you wake the machine back up, it “remembers” everything and so needs not go through the boot up process all over again.
“Sleep” is conceptually different than “hibernate” (although manufacturers can sometimes blur the terms). Typically, hibernation is good for much longer period of time, nigh indefinitely. The contents of RAM are written to non-volatile disk where they can stay practically forever. When the computer wakes up, it reloads the RAM with the information stored on the disk.
Waking from hibernation takes a bit longer than waking from sleep, however both are significantly faster than the typical boot cycle.