Bad batteries. Compact cameras have considerable power drain. When using non-rechargeable batteries, use premium quality alkaline cells only. Cheap carbon-zinc cells won't work well. Also, beware of counterfeit "premium" batteries. If you're using rechargeable (NiMH) cells, the cells may have degraded - this may happen for several reasons. Standard NiHM cells have considerable self-discharge, leave them on the shelf for a few months after charge and they may lose more than half of their charge. They may also become "lazy" after lying around unused for long periods. NiMH cells can be a godsend - I have not used a single disposable AA cell for nearly a decade - but they do need a bit of attention.
Dirty or corroded contacts. The contacts in the battery compartment may become dirty over time, or a set of batteries left in the camera may have leaked and corroded the contacts. If they're only a bit dirty, a pencil eraser can be used to clean them. If they're corroded (with green crud on them) a good wipedown with fine emery paper might be a more appropriate solution. The contacts on the inside of the battery cover are easy to clean, cleaning those on the bottom of the battery compartment requires a bit of patience.
Faulty electronics. Sometimes, electronic equipment may develop faults that result in excessive power drain, which means batteries run low very quickly. In this case, there's not much you can do: diagnosing this sort of problems requires extensive troubleshooting skills and at least a decent multimeter.