When your computer doesn't go to sleep, check all your settings and factors that prevent a sleep state.

The hardware, power options, and configuration can affect the way power and sleep buttons work.

If your PC has updates installed or there's an installed app that requires a restart, then your PC may not sleep at all.