Programmable remotes like Logitech Harmony remotes have an online database to tell their remote the correct coding format for many products.
As a last resort, the Harmony remotes also have a learning mode which reads another remote's code. It is not perfectly accurate in reading another remotes but does a pretty good job, usually good enough to have the function work properly. The toughest job is to read the high frequency carrier which can be between 30 kHz to 60 kHz.
To do a single key function to multiple devices it sends their codes serial. For example to turn on the HDTV, Hometheater amp, and satellite receiver it sends the power command for one then another, then another. It may also select the correct amp input selection or other setup functions. It does this relatively fast so you don't notice the delay.
It is a good PIC microcontroller project.