The Rambam often closes specific sections of Halacha with an aggadic or moral teaching. Thus it is not surprising that at the conclusion of Hilchos Lulav (8:15) he does the same. What is surprising, however, is the specific teaching he chooses. The last halachic topic he deals with there is the special simcha that was present at the Simchas Beis Hashoeva celebrations in the Beis Hamikdash during Succos. The Rambam then teaches that the emotion with which one performs mitzvos is so significant that if the performance lacks happiness and joy, one is fit for Divine retribution, as it says, "because you did not serve Hashem, your G-d, amid gladness and goodness of heart" (Devarim 28:47). One would have expected that his final teaching would be related to kabbolas pnei haShechina (greeting the Divine presence, as was done at the Simchas Beis Hashoeva), perhaps throughout the year in our synagogues and study halls, and we would have placed this lesson regarding the importance of performing mitzvos with enthusiasm earlier in Hilchos De'os where Rambam discusses the overall character of man.
I heard from one of my teachers a fascinating explanation as to why the Rambam ends Hilchos Lulav with the concept of simcha shel mitzvah. The Yalkut Shimoni (Tehillim 102:19) cites the verse "Let this be recorded for a later generation, so that the newborn people will praise G-d." Commenting on "v'am nivrah yehallel Kah - so that the newborn people will praise G-d" the rabbis ask: is there a nation yet to be reborn? Rather the verse refers to the generations that are "as dead" in their actions and mitzvos, and they pray and beseech Hashem on Rosh Hashana and Yom Kippur and G-d recreates them, giving them another opportunity. What is this am nivrah - this newly created nation - to do? They are to "yehallel Kah" - to take their Lulav and Esrog and praise Hashem therewith. Why specifically with the four species?
Rabbeinu Bachaya in his commentary on Parshas Emor and in his Kad Hamkemach explains why these four minim were singled out for the mitzvah on Succos. The essence of the fruit, he notes, is its moisture, as the text states (Devorim 12:25) "ki hadam hu hanefesh - for the blood, it is the life". Similarly, in the world of vegetation the moisture contained within comprises its life and freshness. These four species reflect the freshness endowed within them, and they are taken as a symbol of vibrancy and life, with which to praise Hashem for His renewing us and giving us a second chance to serve Him.
The halacha is that a dry lulav is pasul (may not be used) for the mitzvah. Though it is clearly recognizable as a lulav, the Raavad (Hilchos Lulav, 8:9) explains that a dried out, i.e. dead, lulav can not be used for serving Hashem, as the passuk (Tehillim 115:12) says, "lo hameisim yehalelu Kah - the dead can not praise G-d." Thus, the lulav and its components were chosen as the medium to thank Hashem for the opportunity to serve Him with excitement and enthusiasm, as they themselves bespeak life.
Regarding man, in Parshas Breishis (2:7) we are taught, "vayipach b'apav nishmas chaim - He blew into his nostrils the soul of life." There is man with a soul, alive, energetic, with great and unlimited potential, and there is man without a soul, lifeless. Similarly, there are the mitzvos of man with and without a soul. A mitzvah performed with simcha - happiness and joy - is a mitzvah possessing a soul, and the same mitzvah performed perfunctorily, out of habit and routine, is literally lifeless.
Many have the practice, based on the Ari z"l and Shalah Hakadosh, to fulfill the mitzvah of picking up the four minim in the Succah. Perhaps the message is that one needs the environment of the Succah, which reminds the dweller that he has left his permanent residence to dwell in a temporary one, literally in Hashem's home and presence, to enable him to perform mitzvos with excitement and the realization that one is in Hashem's presence. Too often throughout the year we are so distracted that we fail to be cognizant of our performing mitzvos in the presence of, and praying literally to, Hashem. The Chofetz Chain zt"l in his Shem Olam writes "tell me truthfully my brothers - do you consider the closeness and potential of man to G-d on a daily basis, weekly basis, monthly or even annual basis?" The Rambam writes that the simcha accompanying our mitzvos is to be there all the time, but we learn it from lulav, hence he teaches this lesson here in Hilchos Lulav and not in Hilchos De'os.