in the case of @Jason and others who are wine enthusiasts and think of their wine selection as carefully as they do their food - and request a somm - then yes it probably is not some perfunctory function.
Let me clarify a bit, if I may. I spent 40+ years working in the wine trade: retail and restaurants; wholesale and import; and in wineries, both in production and sales. I have been a wine writer for national and regional magazines, as well as local newspapers, and I had a wine show on FM radio in the Monterey Bay. I’ve served as a wine judge in various competitions, been part of tasting panels for several national publications, and have served on the California State Fair’s Wine Competition Advisory Board for the past 20 or so years.
This does NOT mean I’m an expert. I am not. I always have more to learn. That said, when it comes to restaurants, I rarely ask the somm for a wine recommendation, but may ask of him or her something like, “Do you know which wine is drinking better now, Chateau Cache Phloe or Domaine Jean Deaux?” and then make my final selection from among those two.
BTW, sometimes the wine is selected before the food. Many times, we have contacted a specific chef that we like, presented them (or the restaurant’s somm, if they have one) with a list of wines we wish to bring into the restaurant, and ask the kitchen to make a meal around these wines. It’s actually rather fun!