There are some basic knowledge that you may use everyday but not noticed. For example, most garage and gate remotes only have one button, so how does the door or gate know if it is to close or open? since the transmitted signal from remotes are the same every time – take fixed code for example to simplify the question?
The key lies in the receiver part, it's true that transmitter sends the same signal every time, but receiver would determine the following action based on signal and current door or gate status, so the transmitter signal is nothing more but a trigger to activate following movement.
For example, when receiver has received the signal, it will retrieve the current status of garage door through sensors and built-in logic, is it opened, closed, opening, closing? then control the motor to close the door if current status is opened, and other actions are all followed by corresponding programming logic.
Sometimes other sensor would also be involved in, such as infrared sensor, which can output signal to force the door to stop movement when detected somebody under the doorway for safety.
The programming logic is clever enough to determine correct movement in most time, since it is programmed by human himself, so this is the secret why garage or gate can understand what owner want to do.
Our receiver 202U serves as the simple trigger together with remote control, while garage door control board is the real logic processor to control motor, whose one end connects to our receiver's relay output, and the other end connects to garage or gate motor.