Sounds like a kernel panic.
Which could be for hardware, software, or other reasons, so we'll need to find out more.
Once you have started the Mac, open Console (in /Applications/Utilities).
Go thru the logs (system log and console log, and their archived versions) and check (with the search) if there is anything relevant, e.g. searching for shutdown, fail, panic, error, around the time it panicked or when you restarted it.
There should also be a file called panic.log in your system after a kernel panic. Spotlight should find it. If it's present, copy its contents here as those will reveal more info.
Also.. more info about your system will help too. Which Mac? Which version of Mac OS X?
What do you mean it has been off at night? As in shut down, or lid down, or asleep..?