First, pour the gin and vermouth over ice in a glass and stir. Then rinse off the olive, either with water or a little vermouth, to get all the grease from the jar off of it. You don't want coagulated oil floating around in your drink. Finally, strain into a cocktail glass and add the olive.
Note that a true martini uses gin, not vodka, and is stirred rather than shaken; shaking waters down the drink considerably and is said to "bruise the gin." Also, note that you can reduce the amount of vermouth to make a drier martini; some people go so far as to pour in a small amount of vermouth, let it coat the ice, and then strain it out before adding the gin (though this is taking an extra-dry a little too far in my opinion.) It is best to use a very herbal gin, such as Beefeater, in my opinion.