Today, I explain a little how a transistor works.
Mosfet or as we all know, switch; it is an electrically operated switch that allows a current flow, it is made of silicon.
These devices can act as a switch without moving parts, and their main function is amplification.
Doping is used to improve the conductivity of semiconductors.
HERE ARE SOME PICTURES THAT EXPLAIN A LITTLE BIT:
This are two links of two videos that explains better the functions of a TRANSISTOR:
https://www.youtube.com/watch?v=7ukDKVHnac4
https://www.youtube.com/watch?v=stM8dgcY1CA