I confirm that the estimation of energy needed takes elevation into account. I set two destination of different elevation but the same distance, and the car gives smaller value of SOC left for the higher one.
However, the calculation for "the distance the car may drive" may be as simple as
distance = energy / "consumption rate"
where "consumption rate" is the current consumption in Wh/mi. At the start, the consumption may be small, but will be increase when you are driving on the mountain road thus resulting the OP's situation.
For example, consumption of flat road is 400Wh/mi and 800Wh/mi for mountain road, and you will drive 20mi flat plus 20mi mountain, the energy needed is 8kWh for flat road plus 16kWh for mountain, and you have 24kWh energy left on your car.
At start, the estimated range will be 24kWh/0.4=60mi, giving the false impression that there will be 20mi left when arriving at the destination. However when you've driven 30mi (10mi on mountain), the current consumption will be 800Wh/mi, then the estimate range left will be 8kWh/0.8=10mi, then there will be nothing left on arrival.