Through some clever arrangement (and some other circuit components), we can make a logic gate circuit out of transistors.
A and B are inputs, Out is the output.
Given input A and B, different types of gates respond differently to the input.
Input and output can either be ON or OFF (0 or 1).
0 and 1 simply correspond to two levels of electricity (for example, 0V and 3V).