Derfel did a great job in the top write up here, and I recommend you follow his advice when you find yourself in that kind of circumstance. But there are other times when different behaviour might be more appropriate.
Here is the most basic piece of advice. In a restaurant, no matter how posh and pretentious, there is only one thing you need to do when offered a glass of wine to taste. Sniff it.
If it smells of old laundry or damp socks, even a little bit, send it back, telling the waiter it is corked. Otherwise, smile and nod at the waiter and then drink the stuff at your leisure. That's all.
Be aware, however, that corked wines are quite unusual. It's a once-in-ten-years kind of thing.
How to look like an expert
If, on the other hand, you want to bluff your way through the wine tasting ritual, then here are some tips.
First, take a small bite of dry bread, and a sip of cold water to clean your palate.
Next, find a white piece of fabric or paper--a tablecloth or napkin is ideal--and look at the wine against this white background. If the light is too dim, get a candle or a brighter light to see by. If the restaurant is any good, they should have provided plain, untinted glasses with minimal patterning on the surface. To look at a wine, you need a clean, unfussy glass, ideally with no engraving, and certainly no colouring.
Look at the wine in the glass, and note how clear it is. Any hint of cloudiness is a bad sign. Then tilt the glass on its side a bit, and look at the colour, note how the colour changes from the deepest point all the way to the edge of the liquid, where it touches the glass at its shallowest point. Look carefuly and make a note of the colours.
Swirl the wine around in the glass. Note how the wine runs down the inside walls of the glass--look for the legs. The more legs it has, the more concentrated it is in terms of sugar and alcohol.
Swirl it around once more, and sniff. Put your nose right in the bowl of the glass, and sniff hard. Do that a couple of times. Think what the smell reminds you of. At this point, if you smell any damp towels or old socks, it is time to send the wine back, or tip it down the drain.
Assuming the wine smells OK, and if you really want to lay it on thick, look at the wine again, tilting the glass against that white background. Look a bit harder at the colours, green? brown? purple? Decide what colours you see, especially at the meniscus. Green (in a white wine) or purple (in a red) means the wine is young. Deep gold or brown (in a white) or brown (in a red), means it is older--perhaps too old. Swirl and sniff once more. Think a bit harder about the smells. They can be difficult to identify, so it can help to conjure an image of what the smell reminds you of.
Now take a sip. Enough to half-fill your mouth. Sloosh it like you have just cleaned your teeth. Really sloosh it about. If you don't mind making bathroom type noises, then part your lips and suck air in through your teeth, allowing it to bubble through the wine and up to the back of your throat. Get as much flavour and smell as you can from that part of the tasting.
Next, allow the wine to slip right to the back of your throat and then swallow it. Think all the time of what smells, flavours and memories the wine evokes. Pause for a few seconds as the last edges of flavour reach up to your nose and tongue.
And finally, if you want to taste a wine to learn and discover, then you do exactly the same as above, except you also make notes at each step of the process. Notes with a pencil and notepad, which you then file for future reference. And instead of swallowing, you might spit it out into a bucket. The reason for this is that professional tasters might try 20 or 30 or even 100 wines in a day. A small mouthful of each adds up to a lot of alcohol. It's not good to taste while drunk.
At a winery
First, there are huge differences between wineries, and especially between cultures in Europe and the Americas. I have never tasted wine in the southern hemisphere, but I would guess it is closer to the US experience than the European.
In France, and most of the rest of Europe, the producers tend to be small companies, often run by the owner and their families, or as a local cooperative among a few dozen local growers. If you buy direct, you pay less than the same wine in the supermarket--assuming you can find the wine in a supermarket.
In the United States, the wine makers are hard-nosed commercial concerns, and their customers are even more ruthless. There are agreements between the winery and the retailer which forbids the winery from selling cheaper than the retailers. You don't even think about buying any wine at a US winery. If you feel embarrassed about not buying wine after a tasting, ask them for a list of stockists and then ask them which is cheaper.
Almost always in Europe, the tasting, or degustation, will start with a light white, move on to heavier whites, and then go to young reds, followed by more mature reds. The French love red wine above all else, so the last wine you are offered will probably be the wine-maker's best.
In California, they seem to follow a different programme, offering the mature reds before the younger ones. I prefer the US approach. Young reds have a lot of tannin (the same stuff that makes over-stewed tea taste foul), and this can coat your palate so that you have no chance to really taste subsequent wines. Also, once you have tasted the good stuff, it is easier to compare the younger wines with the top-quality benchmark.
Another tip at smart US wineries--and I have also seen this on Madeira--is that some wineries have two rooms. One is for the general public, where they give out samples of their mass-market wines for free. There is often another room where you can pay a small sum to taste their good stuff. Usually the payment acts primarily as a deterrent to keep out the freeloaders, and in any case, it only covers the costs of the wines on offer,and perhaps a souvenir tasting glass. But if you appear knowledgeable, or keen to learn, then they will sometimes bring out more wines to try. On Madeira, for example, I paid to try a 100-year-old Malmsey (brown-coloured, massive legs, perfectly balanced: heaven, it was), but after a few minutes of talking to the assistant she brought out a couple more of her favourites to try, at no extra charge.
A note on comparing wines
When I first started tasting wines, I simply refused to believe that I could tell the difference between two fairly similar wines. The very first time I went to a proper tasting, and was given five identical wines from consecutive years, I could not believe how different they were. I do not claim to be able to identify vineyards, varietals and year at a blind tasting. But, when given two wines from consecutive years, I believe that almost everyone can tell that the two are different from each other.
Try it. Buy a couple of wines from the supermarket which look similar, and slosh a dollop in each of two (clean, please) glasses. Swirl, sniff, taste. Don't just knock it back with a plate of pasta, but spend a little time to think about it and see if you can tell the difference. Heck, if not then make up that pasta and slosh the stuff back. There are worse things in life.
This piece written, formatted and edited in Dann's E2 offline scratchpad