In simple devices you might have a microcontroller in low-power mode which wakes up (generating the enable signals for other devices) when the button is pressed, then goes back to sleep when the button is pressed again. This after considering debouncing, the fact that the user might press the button many times in a row etc...
When you already have a power management framework (as in laptops) it's easy to integrate those features. Besides, there are integrated circuits (like the LTC2950) that can handle power buttons (e.g. debouncing, handling quick successive pushes etc...).