When my battery is drained of power, my laptop will turn off on its own and I am able to start Windows from where it was before it turned off. My question is: where does Windows save all that data? What I mean by that is....Windows must be getting the data somewhere, right? How does it SAVE everything that was open before turning off, then RESUMES everything? Does it go into hibernation or sleep mode? If so, where can I access all of the data that was saved when the laptop went into hibernation/sleep mode and have it restored? Or does all of that data get deleted once it is restored and resumed? Sometimes, my laptop will get drained of power and it will not resume from where it left off...it just starts over again which is annoying.
Your machine would have gone into Standby or Hibernation.
In Standby, the system goes into a low power state, where almost every device loses power. The RAM however is constantly powered, in order to retain your current system state. When you come back out of standby, you're in exactly the same position as before.
Hibernate is similar, except the machines is powered down completely. In order to retain the current system state in RAM, it's saved to a hard drive (Usually
C:\hiberfil.sys) and restored to RAM when the machine is next turned on.
If there are times when your machine doesn't resume correctly, either the hibernation data didn't save properly (although this usually results in a message and asks you to confirm whether you'd like to boot normally), or it went into standby mode and lost power completely, losing the RAM state and forcing the machine to boot cleanly instead.