Short answer. eBike batteries lose range because of aged cells, cold weather, heavy pedal assist use, hill climbing, and dirty electrical connections. Most packs lose 20 percent of range in the first two years, and up to 50 percent by year four.
Step by step
Rule out cold weather. Batteries lose 20 to 40 percent of usable range below 50 degrees F. Compare summer and winter range before assuming the pack is bad.
Check your assist level and terrain. PAS 5 and throttle only riding halve your range compared to PAS 2 or 3. Steep hills triple current draw.
Clean battery contacts. Corroded contacts increase resistance and cause voltage sag under load, which the controller reads as low battery.
Get a capacity test. A load test gives you an actual amp hour reading versus the label. Below 70 percent of rated capacity means replacement is due.