On the rear of your TV connect, with a phono/RCA cable to the Audio R + L sockets, connect the other ends to your Yamaha using the TV in sockets. See photos attached
Hope that helps. HDMI is for video unless the extra pins are added for audio.
Normally makers don't play ball between each other. Yes if it was a Samsung Television and a Samsung Receiver A/V System. Or if you have something like a Cable Box or Satellite System that is made to interact with other makes. Or if it is a Universal Remote.
I think you were just lucky that it happened to use the same frequency. Look in the manual for a scan command.
https://www.google.com/search?q=Connect+Samsung+OLED+S90+remote+to+Yamaha+RX-V361+via+optical
..
You would have to define 'it'.
In a question talking about two items, you need to clearly state 'make model (what it is)' for both items. The main item should be the first 3 words in the question.
..