Just to expand a bit on what Bob said, typically, people choose to make digital audio connections to their receiver to take advantage of higher quality Digital to Audio Converters (DAC's) in the receiver, vs. using the DAC's in the CD player. All digital sources (CD, DVD, etc.) must be converted to analog in order to produce sound (or the correct sound, anyway ). As a rule of thumb, the higher quality DAC's you use for this conversion, the higher quality analog sound you will get as a result.
By making a digital connection, you are bypassing the DAC's in the CD player. That is, the signal is still digital (has not been converted to analog) when it leaves the CD player. Therefore, you will be using the DAC's in your receiver to make the conversion to analog (sound). Also, a lot of people will make all digital connections when they can so that they can use the same DAC's for all of their digital sources, which should yield a similar sound for all digital sources.
With regard to what type of digital connection to make, in my opinion, the difference between the two is negligible. Some claim that one has superior performance, but in my experience, this is due to the quality of the electronics and connectors being used, rather than the connection type itself. Optical cables are more fragile than coaxial cables, but they are immune to electrical ground issues that can occur with standard metal cables. However, optical (toslink) cables use an unusual pentagonal connector that is somewhat difficult to use in dark, difficult to access places (like the back of most of our equipment racks ). Since coaxial digital audio cables use RCA connectors, the connection is far simpler to make.
Anyway, this is a heavily debated topic, but I hope that I have been of some assistance to you.
Which one is correct? The one that sounds best to you. I prefer an analog connection and like the DACs in my Adcom player better than the ones used in a denon3802 receiver. You can switch between the two and they sound different to you, so break out your favorite music and see what you like.
I frequently go back and forth between the two just to make sure I pick the sound I like best.