On my side, I never empty a tank to avoid any impurity to go to injection/carburator system.
I suspect that, remaining km, when the gas light switches on, are calculated according to our previous gas mileage (first ~ 225 km). As soon as the light is on, we usually slow down a bit when we are close to the end. But the gas mileage is still closer to the one achieved during the first 225 km. That could explain why you still have some gas when it is said that two km are remaining.