Most computers have a small battery. In many cases, the battery is soldered directly onto the motherboard, but the battery is usually in some sort of holder so it is easy to replace. Computers are not the only things that have a small battery like this -- camcorders and digital cameras often have them, too. Just about any gadget that keeps track of the time will have a battery.
In your computer (as well as other gadgets), the battery powers a chip called the Real Time Clock (RTC) chip. The RTC is essentially a quartz watch that runs all the time, whether or not the computer has power. The battery powers this clock. When the computer boots up, part of the process is to query the RTC to get the correct time and date. A little quartz clock like this might run for five to seven years off of a small battery. Then it is time to replace the battery.
This does not explain why your computer would not boot, however. You would expect the computer to boot fine but have an incorrect time and date. The reason your computer would not boot is because the RTC chip also contains 64 (or more) bytes of random access memory (RAM). The clock uses 10 bytes of this space, leaving 54 bytes for other purposes. The BIOS stores all sorts of information in the CMOS RAM area, like the number of floppy and hard disk drives, the hard disk drive type, etc. If the CMOS RAM loses power, the computer may not know anything about the hard disk configuration of your machine, and therefore it cannot boot.
Many more modern computers are not quite so dependent on the CMOS RAM. They store the settings in non-volatile RAM that works without any power at all. If the battery goes dead, the clock fails but the computer can still boot using the information in the non-volatile RAM area.
These links will help you learn more:
- Maxim Real Time Clocks
- CMOS RAM
- Computer Clock (CMOS) Batteries
- How PC Power Supplies Work
- How RAM Works
- How Batteries Work
- How Quartz Watches Work