Why do some count the Omer before Aleinu and some after?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Nusach Ari (as arranged by R' Shneur Zalman of Liadi) counts it before Aleinu. Shaar Hakollel (49:7) explains that this way, the kaddish recited after Aleinu also covers the chapter of Tehillim (Psalm 67) and the verses from the Torah (Lev. 23:15-16) recited after the sefirah.
Mishnah Berurah (489:2) gives another reason: this way it's done as early as possible, so that the seven weeks are "complete" (temimos).
On the other hand, in Beur Halachah (ד"ה אחר) he cites R' Yaakov Emden (Mor Uketziah) who says that it's recited after Maariv because in earlier times it was common to pray Maariv before nightfall, so it wouldn't be time for counting the Omer until after it was over. Perhaps, then, this explains the custom to wait until after Aleinu.
To supplement, not supplant, R'Alex's good answer, I'll just note that a synagogue I used to pray in had minyanim for maariv at several times during the evening, including one that was, at this time of year, such that the end of the service was during a time that some maintain is not yet tzes hakochavim. That minyan counted the omer after alenu, so as to delay it to a time that was more likely (if slightly more likely) night, whereas later minyanim counted before alenu, per the Mishna B'rura.
It is noted in the sefer Maaseh Rav (69) that the Vilna Gaon said sefirah after aleinu.
The Kovetz Mefarshim on the Maaseh Rav gives a reason for this order. He says that aleinu was placed as part of teffilah (siman 132), and sefirah is not a part of teffilah: rather it is a mitzvah by itself. Based on this, one should not make an interruption with a different mitzvah before one completes the teffilah of aleinu.