When it comes time to connect your shiny new sound bar or AV receiver, your two main choices are HDMI or optical digital audio.
The simplest advice is to go with HDMI when you can. But if you can't it's not the end of the world.
Here are the pros and cons of each.
Both HDMI and optical pass digital audio from one device to another. Both are better than analog (the red and white cables). Both can pass multi-channel audio, like Dolby Digital. Both cables can be had pretty cheap.
In terms of simplicity, HDMI also passes video signals. So if you want just a single cable between two devices, HDMI is your pick.
Depending on your gear, you might not have the option for HDMI. Maybe you have an older receiver. Maybe you have everything connected to your TV, and you just want to get the audio out to a sound bar (and the only option is optical).
In that case, optical is fine. Don't sweat not being able to connect with HDMI. For most setups, the sound will be just as good with optical as with HDMI.
One complication is if you have a sound bar, like the Sonos Playbar or Vizio S4251w-B4, that benefits from a surround sound signal and you connect it to one of the many TVs that can't pass such a signal via its optical outputs. Neither of those sound bars have HDMI inputs anyway, so the best way to connect them is directly from the source to the bar via optical, skipping the TV. That, or get a new TV.
Better, a little...
Regardless of the gear you use, as mentioned there's also no way to get Dolby TrueHD or DTS HD Master Audio with an optical connection. However, that's not a huge deal.
While there is a difference between Dolby Digital and those high-res lossless formats, the difference isn't as pronounced as you might expect. On a decent system, with decent speakers, you might notice that the high-res formats are a little more open, a little smoother sounding.
On lesser gear, it's a lot less likely you'll hear a difference. Most sound bars, for example, lack the fidelity to do anything with the additional resolution. Many don't accept those formats at all.
Use HDMI when you can. The cables are cheap, and having just one wire simplifies setup. If you can't, optical is fine. If your gear doesn't have HDMI, it can't take advantage of the high-resolution audio formats from Blu-ray anyway (unless you connect with analog, and decode from your Blu-ray player). On the other hand Dolby Digital is surprisingly good, and unless you have decent gear, you probably won't hear much (if any) improvement with Dolby TrueHD and DTS HD MA.
Got a question for Geoff? First, check out all the other articles he's written on topics like why all HDMI cables are the same, LED LCD vs. plasma, active versus passive 3D, and more. Still have a question? Send him an e-mail! He won't tell you what TV to buy, but he might use your letter in a future article. You can also send him a message on Twitter @TechWriterGeoff or Google+.