If your Mac appears offline post-reboot, it may be due to the FileVault feature being active. FileVault, when enabled, automatically secures your hard disk after a restart by encrypting it, preventing any applications or even the OS itself from running unless the disk is unlocked with the correct password. To regain access remotely, someone physically present must unlock the disk. However, there are alternative solutions for such situations. More on this is described in the solution section below.
The reason why nothing runs when FileVault is enabled is that it provides full-disk encryption (FDE) for your Mac, which means all the data on your disk is secured and unreadable until it's decrypted with the correct password. This is a security feature that prevents unauthorized access to the information on your disk. When your Mac is restarted, the disk is locked, and nothing can run or access the data until the correct password is entered to unlock (decrypt) the disk.
Determine if Filevault is enabled on your Mac
Open up System Preferences -> Security & Privacy -> FileVault. If Filevault is enabled you should see a message saying that "Filevault is turned on for the disk".
Solution 1 (Recommended): Use authenticated restarts when restarting the Mac remotely
If you want to restart the machine remotely, don't restart it from Finder. Instead use the authenticated restart sequence. This has to be done on the remote machine using the Terminal app. Open up the Terminal app and enter the following command and press enter:
sudo fdesetup authrestart
You will be asked for your user name and password. Once you enter this, the mac will immediately reboot and you should be able to connect.
Solution 2 (Not recommend): Turn off FileVault
On your Mac: System Preferences -> Security & Privacy -> FileVault. Click the lock icon, enter your password and turn click 'Turn Off FileVault'.