The two most common remote keyless-entry devices are:
The fob that you carry on your keychain or use to open the garage door is actually a small radio transmitter. When you push a button on the fob, you turn on the transmitter and it sends a code to the receiver (either in the car or in the garage). Inside the car or garage is a radio receiver tuned to the frequency that the transmitter is using (300 or 400 MHz is typical for modern systems). The transmitter is similar to the one in a radio-controlled toy. See How Radio Works for details on radio waves and radio transmitters.
In the very early days of garage door openers, around the 1950s, the transmitters were extremely simple. They sent out a single signal, and the garage door opener responded by opening or closing. As garage door openers became common, the simplicity of this system created a big problem -- anyone could drive down the street with a transmitter and open any garage door! They all used the same frequency and there was no security.
By the 1970s, garage door openers had gotten slightly more sophisticated. You can see this level of sophistication in the photos below. The first shows a controller chip (black) and a DIP switch (blue). A DIP switch has eight tiny switches arranged in a small package and soldered to the circuit board. By setting the DIP switches inside the transmitter, you controlled the code that the transmitter sent. The garage door would only open if the receiver's DIP switch were set to the same pattern. This provided some level of security, but not much. Eight DIP switches provide only 256 possible combinations. That's enough to keep several neighbors from opening each other's doors, but not enough to provide any real security.
The transmitters in these circa-1970 garage door openers were also very simple:
As you can see, the transmitter consisted of two transistors and a couple of resistors, and not much else. A two-transistor transmitter like this, powered by a 9-volt battery, is as simple as a radio transmitter gets. It's the same transmitter that you find in a $10 pair of low-power walkie-talkies.
Remote-entry transmitters have gotten a lot more sophisticated since then. Let's take a look at a modern setup.