a battery will generally last 4 to 5 years. A few things that shorten the life, is limited use, in other words you don't drive the car often or not far. Sitting is not good for the life of the battery.
The thing that kills a battery the fastest is rapid and deep discharges, or completley discharging a battery and then recharging.
A battery springing a leak is something completley different. If a leak develops either its from a deffective case, or the battery was rubbing on someting and overtime the battery case was worn through. Best way to prevent this is to make sure the battery is securely mounted.
If battery acid was leaked from the battery inder the hood I suggest flushing the area with a large volume of water and baking soda mixture (5 gallons of water mixed with 1 lb. baking soda) to help flush away and neutralize any residual acid. The acid will casue and exposed bare metal areas to quickly corrode. After flushing with the solution liberally flush the area with large volumes of water to be sure all the acid is flushed away.