You wouldn’t think that suerte (Spanish for “luck”) would be related to the English sort. They sound similar — both with an s-r mapping to each other — but the definitions are completely different. How could they be related?
Both come from the Latin sortem meaning, “fate, lot” (“lot” in the sense of “your lot in life”).
The evolution of sortem into the Spanish suerte is straightforward: “luck” is just a less metaphysical version of “fate” — fate without attributing it to the Gods.
But the same evolved into the English sort because, your fate, your lot in life sorted you into a class, a rank. In the hierarchical view of the world (which the Romans had) everything and everyone existed in degrees. So your fate was also your portion: what you were given. Thus, the ranking of everything by degrees is… a sorting.
This, too, explains the other definition of the word lot: not only your fate but the portion that has been allocated to you.