There are two different ways of counting the Omer. Some say "לעומר" while others say "בעומר". The difference is reflected in the difference between the counting of a נדה and the counting of a זבה. The counting of a נדה is done even when the woman is still menstruating for all seven days [this is no longer the custom as today we are more strict but that is basic Biblical law] while the counting of a זבה is specifically when she is no longer menstruating and clean. The counting of the נדה is counting the days when Tumah is leaving the her and when it completely leaves her she immerses in a mikva and becomes pure. In contrast, the counting of the זבה comes to shine the light of purity. During the seven days the purity enters more and more and when the days are over, the purity is completed. Jewish women have taken upon themselves to be stringent and to wait seven clean day no matter what, even for a tiny drop of blood [Niddah 66a, Brachos 31a]. In other words they chose the higher level, to bring purity through their counting.
So too Sfiras Ha-omer [the "counting" of the Omer]. Omer is a korban that comes from barley which is animal food [Sotah 15b]. Sometimes our animalism departs over the course of the entire Sefira and sometimes it departs on the first night of Pesach - ליל שמורים - through the fulfillment of all the mitzvos of the night. The idea of the Sefira is also to bring in purity from the light of the Torah that will be given on Shavuos.
Corresponding to the teaching that Sefirah removes the animalism we say "בעומר", in other words the act of the Omer and its purpose has not yet been completed. We are still "בעומר" - in the Omer. We still have the animalistic characteristics as symbolized by the Omer. And corresponding to the teaching that the counting comes to bring in purity from the light of Torah we say "לעומר" - "to" the Omer. In other words to AFTER the bringing of the Omer and the fulfillment of its purpose.
The purpose of a person during all of the days that he lives on the earth is to finish the Avoda of the Geulah of the portion of free choice [bechirah] that was given in Galus and once a person dies he is freed from the mitzvos [Shabbos 30a]. Meaning, that he comes to the level of bechirah that will be revealed in the future. The Torah says that there is a place for this bechirah even when there is no evil in the world.
However, nobody merited to to fulfill this purpose besides Rebbe Shimon Bar Yochai. Although there were people greater than he such as the Members of the Great Assembly [אנשי כנסת הגדולה], the prophets and Moshe Rabbeinu the Faithful Shepherd. Nevertheless, commensurate to their great level, they didn't complete their task in life. Therefore the day of the passing of Rebbe Shimon was so special. The day he finished his tikkun, was the day of his passing.
[עפ"י מי מרום פרשת אמור]