A battery, in concept, can be any device that stores energy for later use. A rock, pushed to the top of a hill, can be considered a kind of battery, since the energy used to push it up the hill (chemical energy, from muscles or combustion engines) is converted and stored as potential kinetic enrgy at the top of the hill. Later, that energy is released as kinetic and thermal energy when the rock rolls down the hill. Not real practical for everyday use though.
Common use of the word, "battery" in electrical terms, is limited to an electrochemical device that converts chemical energy into electricity, by a galvanic cell. A galvanic cell is a fairly simple device consisting of two electrodes of different metals or metal compounds (an anode and a cathode) and an electrolyte (usually acid, but some are alkaline) solution. A "Battery" is two or more of those cells in series, although many types of single cells are usually referred to as batteries - such as flashlight batteries.
As noted above, a battery is an electrical storage device. Batteries do not make electricity, they store it, just as a water tank stores water for future use. As chemicals in the battery change, electrical energy is stored or released. In rechargeable batteries this process can be repeated many times. Batteries are not 100% efficient - some energy is lost as heat and chemical reactions when charging and discharging. If you use 1000 watts from a battery, it might take 1050 or 1250 watts or more to fully recharge it.
Part - or most - of the loss in charging and discharging batteries is due to internal resistance. This is converted to heat, which is why batteries get warm when being charged up. The lower the internal resistance, the better.
Slower charging and discharging rates are more efficient. A battery rated at 180 amp-hours over 6 hours might be rated at 220 AH at the 20-hour rate, and 260 AH at the 48-hour rate. Much of this loss of efficiency is due to higher internal resistance at higher amperage rates - internal resistance is not a constant - kind of like "the more you push, the more it pushes back".
Typical efficiency in a lead-acid battery is 85-95%, in alkaline and NiCad battery it is about 65%. True deep cycle AGM's (such as Concorde and Deka) can approach 98%.
Practically all batteries used in PV and all but the smallest backup systems are Lead-Acid type batteries. Even after over a century of use, they still offer the best price to power ratio. A few systems use NiCad, but we do not recommend them except in cases where extremely cold temperatures (-50 F or less) are common. They are expensive to buy, and very expensive to dispose of due the the hazardous nature of Cadmium.
We have had almost no direct experience with the NiFe (alkaline) batteries, but from what we have learned from others we do not not recommend them - one major disadvantage is that there is a large voltage difference between the fully charged and discharged state. Another problem is that they are very inefficient - you lose from 30-40% in heat just in charging and discharging them. Many inverters and charge controls have a hard time with them. It appears that the only current source for new cells seems to be from Hungary.
An important fact is that ALL of the batteries commonly used in deep cycle applications are Lead-Acid. This includes the standard flooded (wet) batteries, gelled, and AGM. They all use the same chemistry, although the actual construction of the plates etc varies.
NiCads, Nickel-Iron, and other types are found in a few systems, but are not common due to their expense, environmental hazards, and/or poor efficiency.
Batteries are divided in two ways, by application (what they are used for) and construction (how they are built). The major applications are automotive, marine, and deep-cycle. Deep-cycle includes solar electric (PV), backup power, and RV and boat "house" batteries. The major construction types are flooded (wet), gelled, and AGM (Absorbed Glass Mat). AGM batteries are also sometimes called "starved electrolyte" or "dry", because the fiberglass mat is only 95% saturated with Sulfuric acid and there is no excess liquid.
Flooded may be standard, with removable caps, or the so-called "maintenance free" (that means they are designed to die one week after the warranty runs out). All gelled are sealed and are "valve regulated", which means that a tiny valve keeps a slight positive pressure. Nearly all AGM batteries are sealed valve regulated (commonly referred to as "VRLA" - Valve Regulated Lead-Acid). Most valve regulated are under some pressure - 1 to 4 psi at sea level.
The lifespan of a battery will vary considerably with how it is used, how it is maintained and charged, temperature, and other factors. In extreme cases, it can vary to extremes - we have seen L-16's killed in less than a year by severe overcharging, and we have a large set of surplus telephone batteries that sees only occasional (5-10 times per year) heavy service that are now over 25 years old. We have seen gelled cells destroyed in one day when overcharged with a large automotive charger. We have seen golf cart batteries destroyed without ever being used in less than a year because they were left sitting in a hot garage without being charged. Even the so-called "dry charged" (where you add acid when you need them) have a shelf life of 18 months at most. They are not totally dry - they are actually filled with acid, the plates formed and charged, then the acid is dumped out.
These are some typical (minimum - maximum) typical expectations for batteries if used in deep cycle service. There are so many variables, such as depth of discharge, maintenance, temperature, how often and how deep cycled, etc. that it is almost impossible to give a fixed number.
Starting: 3-12 months
Marine: 1-6 years
Golf cart: 2-7 years
AGM deep cycle: 4-7 years
Gelled deep cycle: 2-5 years
Deep cycle (L-16 type etc): 4-8 years
Rolls-Surrette premium deep cycle: 7-15 years
Industrial deep cycle: 10-20+ years
Telephone (float): 2-20 years. These are usually special purpose "float service", but often appear on the surplus market as "deep cycle". They can vary considerably, depending on age, usage, care, and type.
NiFe (alkaline): 5-35 years
NiCad: 1-20 years