The Queen invites someone to form a government on the assumption they've got a majority.
Because the Queen assumes that a party leader carries the votes of their own party. And that may turn out to be wrong, but she assumes it to begin with.
The Queen doesn't work like that.