The actual mechanics are complicated, a mess, and (in the case of the current President of the European Commission) made up out of whole cloth with no legal basis and used exactly once so far, but a rough summary is: through shady backroom deals we have no visibility into.