Why does my Iconia A500 occasionally stop responding?
Ahh, soft keys.

When the power button is pressed, the hardware raises an interrupt which is handled by an OS-provided interrupt handler.  Part of the interrupt handling process included waking the processor from sleep.  The software will then turn on the screen (if it was asleep), display a shutdown menu, or some other function depending on the OS version and any customizations added by the device manufacturer or third-party software installed by the user.

The power button also starts a counter in hardware.  If the counter reaches a threshold without the power button being released, then the power circuit is invoked to turn off the device.  This is done purely in hardware circuitry, independent of the OS or even firmware executed by the main processor.  That's why it still works when the system is locked up (or perhaps overclocked and so unstable that the processor can't execute ANY code at all).