Trying to get a Mac to automatically go to sleep after a while can be frustrating. Many things can interrupt the process, such as network activity and persistent applications. Fortunately, you can use an easy-to-use tab in Activity Monitor to quickly see what can be preventing your Mac from sleeping. See how.

First, let's open the "Activity Monitor". You can locate her application in the Applications> Utilities folder or you can use "Spotlight". Click on the "magnifying glass" icon in its bar menu or press Command + Space. When a search bar, type “activity monitor” and press “Return”.

When the Activity Monitor opens, click the "Energy" tab.

In the "Energy" tab, you will see a list of active processes (background system applications and functions) with information about their energy effect. Look for a column heading labeled "Preventing Sleep" and click on it.

If you see the "Yes" column in the "Preventing Sleep", Then your Mac will not automatically activate the standby function while this procedure is still active. If this is a process you recognize, you can wait for an active task to complete or try closing the application. If this is a process that does not behave as you expect or refuses to close, you can force it to stop.
To force a procedure to close in Activity Monitor (on any tab), select the procedure in list and click the "Stop" button, which looks like a small octagon with an "X" inside.

When Activity Monitor asks you to confirm, do so click in “Force Quit”. After that, if this process was the only one thing which delayed operation suspension your Mac, then your Mac should be asleep the next time you expect it.
Source of information: howtogeek.com