As Joseph explained, shaking a drink breaks up the ice and leaves nasty little ice crystals at the top of the glass.
This was a popular way to drink cocktails in the post-prohibition era when Americans simply forgot how to drink properly.
Fortunately, thanks to the work of a few brave souls (looking at you Dave Wondrich), we now know that drinks made with just alcohol should be stirred while drinks including citrus, egg whites, etc.
Should be shaken.
When you shake a drink, you’re adding air along with little ice chips.
Aerating your cocktail is incredibly important in a sour, which could feel very heavy with all of those viscous and weighty ingredients.
When you just have booze in a glass (like in a Martini.
By the way, a Vesper is a cocktail that while similar is not a Martini), stirring is going to result in a colder, clearer and more enjoyable cocktail.
More Resources on Why does James Bond prefer his martinis shaken not stirred:
Read more about Why does James Bond prefer his martinis shaken not stirred: