Good GENERAL answers to these kinds of hookups
Generally speaking, the goal should be to maintain the best possible sound, which will be digital (optical or cable) for a first option and then analog (red & white RCA jacks) as a secondary option.
The easiest way to get things right is to think about signal flow. Audio will need to flow OUT of the computer and IN to the TV or Receiver. Thus, you need sound output option(s) on the computer and sound input option(s) on the TV or Receiver.
Digital options are first preference. Does your computer have digital out? If your computer doesn't have an digital out option, you'll need to go with analog, probably via a headphone jack. Either way, this will help you identify one end of the cable. And you're already half-way to your goal.
Where is the sound going? If you are trying to make a direct connection to the TV, you need to know what audio inputs the TV can handle. Chances are very good that it will take analog via red & white RCA connections. Chances are pretty good that it might have a digital IN ("IN" being key) connector.
If you are using analog out of the computer, you'll need to go analog into the TV. If you are using digital out of the computer, you need to use digital IN on the TV. Knowing what your TV can handle as audio INputs will help identify the other end of the cable you need.
A very simple analog solution (that is also almost universal): headphone jack out to red & white RCA jacks in. Many laptops (maybe all???) will have the headphone jack. Pretty much every TV will have analog (red & white) RCA jack inputs.
If you have a Receiver, you would probably find it better to route your computer audio directly to the Receiver. And if it is a fairly modern Receiver (made in the last 5+ years), chances are pretty high that it will have digital inputs for audio. Using a Receiver cuts the TV out of the equation for anything but the picture. Sound is pumped out of the computer and into the Receiver. Picture is pumped out of the computer and either directly to the TV, or into the Receiver and then forwarded from the Receiver to the TV.
Lastly, if you are trying to go straight to the TV (no Receiver), and you are pretty sure you have the right connections for audio (audio OUT of the computer, audio IN to the TV), chances are pretty good that you'll need to go into the TV menu settings, audio settings, and tell the TV where to get the audio you want to hear. For example, if you're using analog connections in jacks labeled "2" on your TV, you'll probably need to select Port/Zone 2 in the Menu, Audio settings.
Depending on your TV, you may also need to select "analog audio" or similar to tell the TV to use analog audio vs. digital audio.