There are two scenarios to examine here.
1) Your computer shuts down normally, but without warning. You receive messages notifying you that windows is shutting down, and it then restarts normally.
2) Your computer turns off completely without warning. You do not receive any messages or notification that your windows session is being terminated.
I suspect what is happening is the
second scenario. In that case, if unplugging your computer, waiting about 5-10 seconds, and plugging it back in will allow you to turn your computer on normally, then I can tell you from experience that more than likely, the issue you are encountering is a problem with your motherboard.
Check your motherboard's physical appearance for any abnormalities (bulging capacitors, etc.)
Check for any unusual smells coming from the motherboard.
You may also wish to check the website of your motherboard's manufacturer for firmware updates, however this more than likely will not fix your problem, and
performing a firmware update if your system is unstable and/or loses power unexpectedly is NOT RECOMMENDED.
I hope this helped, even though it's obviously not the news you wanted to hear. 