I recently took the battery out of my LG remote control to do some minor modifications to the case and lost the programming for the small set of functions that work with the TV. There’s not much on the web directly about this, and it’s pretty simple, so I thought I’d throw a quick note up here to save someone 5 minutes in the future.
Here’s a picture of the remote in question.

To program the remote, simply hold down the TV POWER button in the top right corner and press the manufacturer code button for your TV with the numerical buttons (see the table below).
LG: 1 (default), 2
Zenith: 1, 3, 4
GoldStar: 1, 2
Samsung: 6, 7
Emerson: 6
Sony: 8, 9
Hitachi: 4
Westinghouse: 6, 9 (Thanks Stacey, DB)
Magnavox: 2 (Thanks Michael)
Phillips: 12 (Thanks Benjamin)
Then release the TV POWER button to complete programming.