Hamilton could be a lap behind then come in second.
That's not what happened. Hamilton was winning - he was first. He wasn't a lap down. Then behind him on the track were five cars who WERE a lap down and then Verstappen who was second. Behind him there were other cars who were also a lap down. e.g. Ricciardo who was directly behind MV but a lap down.
There was 1 lap of the race left.
The rules say that any cars who are a lap down should be allowed to unlap themselves (drive past the other cars and come round the track to join the end of the train) and then the SC will come in the following lap. If that had happened, the race would have finished while it was going on. LH in first, MV in second - all being led by the SC. There would not have been time to get racing again so MV would never have had chance to overtake LH.
As a slightly controversial option, they could have just got racing again with those cars in the way. There is a chance MV could have got past them all - after all, they are duty bound not to try to stop him as they are a lap behind - and overtaken LH in the single lap left. But maybe this wasn't likely - even with his fresh, soft tyres vs LH's old, hard ones.
But they didn't do either. They made a weird decision to only allow the lapped cars between LH and MV to unlap themsleves - screwing Ricciardo over as he had to stay lapped. Plus, they then brought the SC in immediately after the lapped cars had driven by - rather than the following lap, as per the rules.
and - arrrgh! I am back in 2021 again 😂