Pretty sure they just cut up some numbered paper and drew from a hat -.- Ulquiorra was pretty much #1....or maybe -1 if you count Yammy's "0" raank <.<
I always felt sorry for the guy that was....number 7? Maybe? The black guy that moved so fast he made clones. His death speech about how shinigami just merciless kill hollows and how Aizen wanted to change that, was his reason for fighting. So he actually had a reason to fight and pledge allegiance to Aizen which is a lot more than the other espada.