Many people simply don't take good care of their batteries, which can result in poor battery performance which is no one's fault but their own. To avoid this, here are a few simple tips:
Don't let your laptop overheat. This means making sure that the fans can properly ventilate at all times, and that you don't run it on hard surfaces that won't wick heat away. Even while not running, avoid using your laptop in hot environments—the optimum temperature for laptop batteries is at the freezing point! The cooler the better (but don't be putting it in the fridge.)
Know Your Charger. There are a lot of different types of chargers out there, all of which require startlingly different care for maximum utility. Most old computer chargers allow a small trickle of charge into the battery of your computer which then trickles out into use for the rest of your computer, as opposed to going directly into your computer's functions and bypassing the battery. This trickle wears down the battery over time, slowly but surely, just by using it up. Most newer “smart” battery chargers, however, send power when plugged in directly to the computer and bypass the battery, which helps extend battery life somewhat.
Charge Only When Necessary. If you have one of those older batteries, when you do need to charge your battery, make sure that your battery is completely drained before charging. Remember, the lifetime of lithium batteries are determined by a set number of charge cycles, not by the amount that the battery is charged - you want to avoid that trickle charge effect that was mentioned earlier. Smart batteries conveniently avoid this issue, so keep it plugged in when possible.
Power Management Programs. It's a good idea to get some sort of specific power management program on your computer. While what's available varies by distro, the more options it has, the better. Linux users can adjust everything microscopically via command line, and also have many open source options available; proprietary distros have default apps, which have limited functionality, but are also open to many freeware programs. Check out what's out there!
For the nuances of lithium battery care, refer to the manufacturer's user manual specific to your battery.
If your battery is not lithium, such as NiMH and NiCad, then make sure to look up the optimum care steps that are particular to your type of battery: each of them must be treated differently than lithium batteries.