"A child who knows how to shake [the lulav] is obligated to take the lulav" (Sukkah 42a). As we noted in our first "daily daf" on masechet sukkah here, the mitzva of chinuch, training children in the proper observance of mitzvoth only begins when the mitzva can be done completely. So while one fulfills the mitzva of lulav immediately upon picking it up (even if we don't shake it) we only begin training our children in the mitzva of lulav when they know how to properly shake it.
While it may seem simple enough when to shake the lulav it is a matter of Mishnaic debate. "And where is the lulav to be waved? At the beginning and at the conclusion of "hodu lashem ki tov", give thanks to G-d for He is good (Psalm 118), and at "anna Hashem hoshiah na" (ibid), please G-d, save us. These are the words of Beit Hillel. Beit Shammai says [it should] also [be waved] at "anna Hashem hatzliacha na, please G-d grant us success" (Sukkah 37b). The Mishna does not explain why we shake the lulav nor is any source given for this shaking - one that has no scriptural basis - at least regarding Sukkot.
"And the priest shall wave them with the bread of the first-fruits for a wave-offering before the Lord, with the two lambs; they shall be holy to the Lord for the priest" (Vayikra 23:20). The holiday of Shavuot marks the beginning of the wheat harvest and to celebrate, two loaves of bread, shtei halechem, were offered as bikkurim lashem,the first offerings to G-d. As the bringing of the korban haomer, celebrating the barley harvest on the second day of Pesach allowed one to eat from the "new" grain planted since last Pesach, the shtei halechem "bread of the first fruits" was the trigger to allow the new wheat to be used in the korbanot mincha, the flour offerings in the Temple.
These loaves of bread were to be waved together with the kivsei atzeret, the two lambs offered as a peace offering on Shavuot. The Gemara offers two very different reasons for the shaking of the bread and lambs on Shavuot - and the lulav on Sukkot. "Rav Yochanan explained, [One waves them] to and fro [in honour of] Him to Whom the four directions belong, and up and down [in acknowledgment of] Him to Whom are Heaven and Earth. In the west (Israel) they taught us thus: Rav Hama the son of Ukba stated in the name of Rav Yossi son of Rav Hanina, He waves them to and fro in order to restrain harmful winds; up and down, in order to restrain harmful dews" (Sukkah 37b).
Do we shake the lulav out of joy acknowledging G-d's dominion in the world or out of fear beseeching G-d to save us from the vicissitudes of nature? It appears the answer is both. When we shake the lulav at hodu lashem, as we praise G-d, we rejoice that we may serve the Master of the universe. But when we shake the lulav at anna hashem hoshina na we beseech G-d to protect us amidst the dangerous world the surrounds us.
The shaking of the lulav is "shaiarei hamitza", the leftovers of the mitzva. "This teaches (lit. says) that even the dispensable parts of a commandment prevent calamities; for the waving is a dispensable part of the commandment, and yet it shuts out harmful winds and harmful dews" (Ibid 38a). It really is the little things that so often matter most.
 Later day commentaries debate the exact order of directions in which to shake the lulav and whether it is to actually be shaken or just moved back and forth in each direction.
 As we read last week (Vayikra 6:10) one was not allowed to bring a korban mincha containing chametz. We are slaves to G-d and can't relax and take our time in the service of G-d. The shtei halechem on Shavuot were an exception symbolizing that with the acceptance of the Torah on Shavuot our freedom was completed. The kivsei atzeret was the only korban tzibbur, communal offering that was a korban shelamim, thus the only public offering where the public can actually partake of the meat of the animal. This seems to reflect a similar idea and perhaps these lambs should be seen as a "korban pesach" for the community serving as another link between these two holidays.
 Rav Yochanan was also in the west, the leading Sage in the land of Israel. "In the west they taught" is likely a popular teaching said by many.