Modern ATX motherboards don't cut power when you push the switch. Instead it sends a signal to the motherboard saying you would like to shut down. If the OS is up and running, it is usually able to detect this request as well.

Older AT machines had the power switch wired into the power supply....