I understand that it is a mitzvah to count the 49 days of the omer from the second night of Pesach through erev Shavuos. But what is the spiritual value of counting s'fira? I.e. what does G-d want me to achieve by doing this mitzvah, if we know?
The Chinuch (306, in my own translation) says:
Among the roots of the command [to count the omer]… is that the whole basis of Israel is for nothing but the Torah… and the reason the Jews were redeemed from Egypt was so they could receive the Torah at Sinai and keep it…. Therefore… we were commanded to count from the day after the holiday of Passover to the day of the giving of the Torah to show our own souls the great yearning for the day…. For counting shows someone that his whole attention and desire is to reach that time.
A theme frequently expressed by the Chinuch (and some others), though not made explicit here, is that a person's actions make him into a person who tends to do those actions. (I know little about cognitive behavioral therapy, but I think this is the basic principle underlying it, too.) Here, then, I think he is trying to say that, by counting the omer as if yearning for the Torah, we will come to yearn for it in fact.
Rabbi Samson Raphael Hirsch, in Horeb (paragraph 214 in Rabbi Dr. Grunfeld's translation), says similarly:
In this way [i.e. by counting the omer] you declare… that Passover finds its culmination in Shavuoth, that is to say, that freedom with all its inherent blessings… acquires worth, reality and meaning only through the principles of the Torah. For Israel was delivered from the bondage of Egypt only to serve the Torah….