the default order is rank, level, ascension level, rarity, and affinity. if you have it set to a sort other than by rank, that one will go first and the remaining four will proceed in the same order they normally would. after it's been sorted by affinity however... it's a mystery. this topic has come up a few times before on the forums and no one has been able to come up with a satisfactory answer as to what the criteria are.
i can confirm that it is not done alphabetically, as krama suggested. nor is it done by faction, champion power, champion type, date added to the game, date acquired on your account, or ranking by any individual stat. tags are also questionable; up until a few hours ago, i was assumed i understood how they worked, but the game is now stubbornly insisting on putting my tagged mordecai before my natural one, despite it always putting the tagged one second prior.
edit: ignore that last part, game has switched to putting tagged version last. still not sure why it didn't do that from the outset, but that's a seperate issue.