Battery management is a key consideration of e-MTB riding and several factors determine the overall range, including rider, environment, terrain, and assist mode. Hilly terrain will draw the battery down faster due to the added output required on ascents. Cold weather can also drain the battery quicker (like a cell phone in the middle of winter). A rider's weight can impact the battery duration as lighter riders will require less power at the same ascent speed as their heavier counterparts.
The assist mode will also determine how far the battery can go. As a general rule, it's easier to think of battery range in terms of elevation since climbing requires the most assistance from the motor. Plan on batteries in Boost mode climbing 2,000 feet, Trail mode 3,000 feet, and Eco mode 4,000+ feet.