These range predictions are a classic case of only being as good as the information being fed into them. What the car does is look at the previous, say, 100km of driving that you’ve done. If that was on a highway, the computer will know that for the last 100km, average fuel consumption was, let’s say, 10 litres per 100km (to keep the maths simple). So, if you still have 20 litres in the tank (which the computer will also know) the computer will figure that you have 200km of range left.
But, if your next driving stint is in stop-start traffic, your fuel consumption might easily rise to 15 litres per 100km, at which point, those 20 remaining litres are only enough for 133km. The farther you drive at your new consumption rate of 15 litres per 100km, the more the computer will realise that the previous range estimation is suddenly wrong and it will move to fix that by constantly reducing the range readout until it matches your actual fuel consumption.
It works the other way, too, and a change from suburban driving to highway work will see the computer hustle to reflect the current consumption and will actually start to increase the range estimation until it all starts to average out again.
This, of course, is the case assuming all the sensors and computers are accurate, and any false or misleading piece of information fed to the computer will also lead to wildly inaccurate range estimates.