The transistor is a device that that enable automatic switching of electrical signals. It was invented by William Shockley, John Bardeen and Walter Brattain and started the whole computer industry.
A transistor is a resistor whose values can vary based transistor on an input voltage value.
The electrical signal switch off and on is based on the voltage level:
As the resistor value vary between this voltage, a transistor can also be used as a current amplifier (more voltage, less resistance)
Bit are implemented with transistor where: