When your car's battery is charging, it gives off gases, which pass out the top of the battery into the atmosphere. They can also cause battery terminals to corrode. Severe corrosion can make your battery's signal too weak to start the car -- even though the battery itself may be perfectly good. You can prevent this by simply cleaning the battery posts and battery cable terminals.
You'll need a post/terminal cleaner,available at auto-parts supply stores. It costs a dollar or two, and will last for years. Basically, it's a pair of wire brushes made especially to clean battery terminals. One fits over the battery posts, and the other fits inside the cable terminals.
Make sure the ignition is turned off. Remove the negative cable from the battery first (it's marked with a minus sign or an abreviation, such as "NEG"), then the positive one (marked with a plus sign, or an abbreviation such as "POS").
Push the post/terminal brush over each post in turn, and rotate the brush back and forth until the post is bright and shiny.
Then stick the other end of the brush inside the cable connection, and rotate it back and forth until the inside is shiny.
While you've got the cables disconnected, it's not a bad idea to wash the top and sides of the battery with a mixture of baking soda and water, to neutralize any acid that might be on the battery shell. While you're at it, it doesn't hurt to coat the battery posts and cable terminals with petroleum jelly (Vaseline) to help deter future corrosion. Replace the cables positive first, then negative.
If your battery's terminals are on the sides, the procedures are the same; but the problems are less likely to arise. Side-terminal batteries aren't as prone to corrosion as vertical-post batteries, because the gases are vented out at the top of the battery,so they're not as likely to make contact with the connections of a side-terminal battery.
Keeping battery connections clean will all but eliminate the possibility of a no-start caused by battery corrosion.