Anybody that thinks it might be a Scheduled Task, just try to set up a Scheduled Task on your own system to wake it up at midnight when it is shutdown (not sleeping) and you will see what I mean, then tell us how that works out for you. Can you get it to work?
It is more likely that your system is getting a "magic packet" from your Internet Service provider (ISP).
That means that even if the system is turned off, some systems have a feature that will wake them up when there is some activity on their Internet connection - even if the machine is powered off (that is by design and can be useful).
Sometimes this can be referred to as receiving a "magic packet" that is just what the system needs to see on the Internet connection to wake itself up. Often these things seem to happen shortly after midnight when your Internet Service Provide (ISP) might be sending out these magic packets.
You can read some about it here:
Wake on LAN (WoL) support is sometimes implemented in the motherboard of the computer. Most modern motherboards with an embedded Ethernet controller support WoL so you need to find that option/feature and disable it.
To test the WoL theory, the next time you turn off your computer for the day, physically unplug the Internet connection from the computer and then wait (as long as you think it takes to convince you) and see if the system turns itself on or not when the cable is unplugged at the time you suspect - after waiting longer than it usually takes for it to turn on by itself (which may be overnight). That means you may have to wait a day or two to test this idea.
There could be a setting in your system BIOS to enable/disable this feature or in your network card, but since we don't know anything about your system, that is just a guess. You can look around in your system BIOS and see if you can spot this feature and disable it, save the setting and see how things look.
You might visit the manufacturers web site for your system to see how to disable this feature.
There could also be a setting to disable in the Properties of your network interface card to not allow the system to be started or come out of hibernation or standby/sleep on a signal from the device or router. You can look in Device Manager and the Properties of your device for those settings and disable those features.
Look for a "Power Management" tab.
On my motherboard in the system BIOS settings under Power Management is a section called "Wake Up Setup Event" and under that are the various ways that one could configure the system to wake up from some event. Under that section are things like keyboard, mouse and one is "Resume by Onboard LAN" which if I enable that, and the correct "magic packet" comes into the built in Ethernet connection, my system would startup by itself.
In Device Manager, Network adapter, for a NVIDIA network controller under Properties, Advanced there are settings called "Wake on Magic Packet" and "Wake on pattern Match" that can be disabled.
Try not to think of it as a Windows thing you need to change - it is more of a hardware thing that has to do with your motherboard and/or network interface and the way you connect to the Internet.
Another possibility is that if you have your system configured to allow a device (mouse or keyboard) to wake the computer with a click or key press and if you have cats they might be walking on your devices and waking the computer.