Batteries should be replaced about every 3 to 5 years, some can even last seven. However, it is obvious that if the battery dies (with no ability to "jump"), is corroted, or gets a dead cell in it then it should be replaced.
If you question the condition of your vehicles battery, drive to your local auto parts store and they can test the battery and the charging system of the vehicle for you at no cost.
Check the battery cables or starter.
Yuor battery is leaking fluids or gases. The battery likely needs replaced.
The life of a car battery really depends on many factors, in addition to time. Amount of use and climate are key factors in the life of a battery. One can expect to have to replace a battery generally every 3 or 4 years, however.
Maybe the car needs gas.
If it has a dead cell the battery will not hold a charge and must be replaced.
A light is on or a relay is stuck pulling power from the battery.
Something else is broken.
Dead cell in the battery or something is on pulling power from the battery. If it is a dead cell the battery must be replaced.
Sounds like your battery has a weak cell and needs to be replaced.
what does it do
It means the battery has been drained of all it's power. Simply recharge the battery with a battery charger and it will be fine. You do not have to replace the battery, although draining the battery fully does harm the battery. Charge the battery fully and it will function as it should.