The most obvious sign of a battery problem is a dead battery. However, because the battery is part of a larger system connected to other parts of the car, a dead battery may indicate a deeper problem than simply no juice. If something else is going wrong in the electrical system -- say, a weak alternator -- a working battery may be providing less electricity than it should.
The best way to test a battery is with the electronic testers available at most automotive shops and even a few auto parts stores. A tech will hook the tester to the battery in the car, and it will take a snapshot of your battery's condition and indicate whether it needs to be replaced. This check should be a part of routine vehicle maintenance and done every time you have an oil change.
The battery itself provides other clues to whether it's on its way out. The first is age. If the battery is older than three or four years, start expecting problems. Second, take a look at your driving habits. Remember, short trips and long periods of inactivity will sap a battery's life. Third, take a look at the battery itself. Corrosion or stains mean you have a leak. If your battery is covered in a case or insulating sleeve, remove it every once in a while to see what's going on underneath. Look for buildup around the terminals as well. You can clean the buildup off with baking soda and water -- just remember to use gloves and safety glasses while working. The electrolytic solution is partially sulfuric acid, which is not gentle on the skin. Finally, smell the battery, paying attention to rotten egg odors (sulfur) or the smell of the battery overheating.
Batteries are so reliable and so simple that drivers have a tendency to forget they're even there until it's too late. If you pay attention to your car's battery and conduct a few tests and observations along the way, you'll reduce your risk of being stranded on the road. All things considered, batteries are relatively inexpensive, considering the amount of work they perform on a regular basis.