How did Moshe determine which firstborn were covered by the Levi'im and which ones had to pay the five Shekalim?
Rashi: By writing 'ben Levi' on twenty-two thousand pieces of paper, and 'five Shekalim' on two hundred and seventy-three, and by then mixing them and placing them in a box, from which each firstborn picked one. 1
See Torah Temimah, note 18.
QUESTIONS ON RASHI
Rashi writes that on twenty-two thousand lots Moshe wrote 'ben Levi' and on two hundred and seventy-three, 'five Shekalim'. Every firstborn picked one. Why can hey not still complain, since everyone will want to take first, when all the lots containing 'Ben Levi' are sill there! The latter can say 'presumably, the first will pick Ben Levi', because they are the majority'?
Moshav Zekenim #1 (in Pasuk 46 citing the Ri): Each B'chor returned his lot to the pile 1 after he showed Moshe what was written on it. 2
Moshav Zekenim #2 (in Pasuk 46, citing his Rebbi): Moshe divided the notes of 'Ben Levi' among several chests, and a group of Bechoros would each take one from a chest.
Moshav Zekenim #3 (in Pasuk 46, citing his Rebbi): Hashem told Moshe who must redeem himself. The lottery was merely to assuage them. Moshe let them pick first, and each one picked a note of 'five Shekalim.' 3
Rosh: Rashi explained according to R. Yehudah. R. Nechemyah maintains that, for each B'chor there was a note saying 'Ben Levi', and one saying 'five Shekalim.' In theory, all could have picked 'Ben Levi', or all 'five Shekalim', or any combination. And it is through a miracle that exactly two hundred and seventy-three picked 'five Shekalim.' 4
Riva #1 (in 11:26) #1 and Moshav Zekenim (on 11:26): The last ones cannot complain, for the former can likewise say 'presumably, the undesired lots will fall among us, for we are the majority.'
Riva #2 (in 11:26) #2: There were as many desired lots as the total number of people who picked, so everyone had a chance to get his desire; there were only two undesired lots (regarding the Sanhedrin, and two hundred and seventy-three regarding the Bechoros).
Yisrael immediately after Matan Torah and the building of the Mishkan were on the highes conceivable levels of Emunah. Consequently, notwihsanding the fact that each B'chor would instincively try to avoid having to pay five Shekalim, once they would see that the lot fell on them to pay, they would immediately accept that this was the wil of Hashem and not complain.
As the Riva in 11:26 explains regarding the lots that ere drawn to pick members of the Sanhedrin.
Moshav Zekenim: This is difficult. If so, it would suffice to have one note 'Ben Levi', and one ''five Shekalim' - and via Hashgachah, two hundred and seventy-three Bechoros will pick the latter?
Moshav Zekenim: If so, it would suffice to have two or three thousand notes of 'Ben Levi'! (Since all two hundred and seventy-three Bechoros picked notes of 'five Shekalim', this was clear proof that Hashem told Moshe who must pay).
Rosh: Some give his explanation regarding the lottery to pick members of the Sanhedrin (Riva and Moshav Zekenim, on 11:26).