Battery life is calculated in charge cycles. This means it depends on the number of full charges (from 0 to 100%) that they can undergo before their effectiveness gradually diminishes, until they no longer function at all.
In theory, an electric bicycle battery can undergo several hundred charge cycles. How much exactly? That depends on the battery type concerned. The way you take care of your battery will also affect its life. For example, if you store your battery somewhere dry and protected from temperature fluctuations, you will keep it longer. In general, with regular use, an electric bike battery becomes less efficient after 3 to 5 years.