doping
Doping is the deliberate, tiny addition of chosen foreign atoms to a pure semiconductor to control its electrical behavior. It sounds like a flaw — you are intentionally contaminating a pristine crystal — but it is the single most important trick in all of electronics. A pinch of the right impurity, a few atoms per million, can raise a semiconductor's conductivity by thousands or millions of times and decide whether it carries current mainly by electrons or by holes.
The mechanism is about counting valence electrons. Silicon has 4 valence electrons and bonds neatly to four neighbors. Replace one silicon atom with a group-V atom like phosphorus, which has 5 valence electrons: four go into bonds and the fifth is left loosely attached, easily freed into the conduction band as a mobile electron — this is a donor, and it makes n-type material. Replace a silicon atom with a group-III atom like boron, which has only 3 valence electrons: one bond is left short an electron, a hole, which neighboring electrons fall into and thereby move — this is an acceptor, and it makes p-type material. A semiconductor doped this way is called extrinsic, because its carriers come from outside atoms rather than from thermal jumps.
Doping's power is that it makes conductivity a design parameter you dial in, not a property you accept. Because a dopant supplies a carrier almost for free (no big band-gap jump needed), even a light doping of one part per million utterly swamps the feeble intrinsic carriers, so the material's behavior becomes stable and predictable rather than at the mercy of temperature. Every diode, transistor, solar cell, and integrated circuit is built by patterning regions of n-type and p-type doping into one crystal. Honest note: doping levels must be controlled to extraordinary precision, because the whole device physics rides on exactly how many dopant atoms sit where.
Add just one phosphorus atom for every million silicon atoms. Intrinsic silicon had about 10^16 carriers per cubic meter; this light doping adds roughly 5 times 10^22 donor electrons per cubic meter — over a million times more. The conductivity leaps accordingly, and the crystal is now firmly n-type, its behavior set by the dopant rather than by chance thermal excitation.
A few atoms per million decide n-type vs p-type and swamp the intrinsic carriers entirely.
Doping does not add net charge — the crystal stays electrically neutral. A phosphorus donor gives up a mobile electron but keeps its own extra proton, so it becomes a fixed positive ion; the mobile carrier moves, the ionized dopant does not.