Which sound settings are in effect when I am watching/listening – the AppleTV's or the Samsung's? Can they conflict with each other?
Sound settings for both would apply, without conflicting. Apple TV can set where sound goes to (to the TV), and in what format (stereo, surround sound, Dolby Atmos). The TV can set where sound goes next. Volume control on Apple TV actually sends that signal to the TV or audio system, so that only one device manages that.
I am considering getting a sound bar,
Awesome; that can vastly improve the sound quality over the TV’s built-in speakers.
… which complicates my concerns.
We’ll do what we can to ease those concerns. It is designed to not conflict.
Things like Optical and eARC go over my head.
Optical is a legacy connection type. If you have HDMI-ARC or HDMI-eARC available (on the TV), then prefer that instead. It allows for all that optical can do, and then some more.
I just want to hear the best sound in the best way.
A soundbar is a fine improvement, but “the best way” is a bit more expensive. 😉
Connect as:
Apple TV →[HDMI]→ TV →[HDMI (e)ARC]→ soundbar.
Set Apple TV to output audio to the TV (“TV speakers”) over HDMI, then set the TV to output any audio to the soundbar.
Set up Dolby Atmos or surround sound on Apple TV with a sound bar or AV receiver - Apple Support
Play audio in Dolby Atmos or surround sound on your Apple TV - Apple Support