Antibiotic resistance is often described as bacteria learning to survive a drug. Nothing learns. The process is selection acting on variation that already exists, made faster by a method of gene sharing that has no equivalent in larger organisms.

Variation precedes the antibiotic

Bacterial populations are enormous and divide rapidly, and each division carries a small chance of a copying error.

Across billions of cells, some will already carry a mutation that happens to reduce the effect of a given drug, before that drug is ever encountered.

The antibiotic does not create these variants. It changes which of them survive to reproduce.

Selection is the whole mechanism

Exposure kills susceptible cells and leaves resistant ones, which then multiply into the space and resources the others occupied.

Within a few generations, a variant that was vanishingly rare can dominate the population.

Incomplete exposure is particularly effective at driving this, because a concentration that kills the most sensitive cells while sparing the moderately resistant ones selects hardest.

Resistance genes move between species

Bacteria also acquire genes horizontally rather than only from a parent cell.

Plasmids, small circular pieces of DNA, can be transferred directly between cells, including between unrelated species, and they often carry several resistance genes together.

This is why resistance can appear in an organism that never encountered the drug, and why a single transfer event can confer resistance to multiple antibiotics at once.

The mechanisms of resistance are varied

Some bacteria produce enzymes that chemically disable the antibiotic before it acts.

Others alter the molecular target so the drug no longer binds, or reduce the permeability of their outer membrane so less enters.

Efflux pumps provide another route, actively expelling the drug from the cell faster than it accumulates.

Where the selection pressure comes from

Every use of an antibiotic applies selection somewhere, including on the many harmless bacteria a person carries, which can then pass genes onward.

Courses that end early leave a surviving population that has been exposed but not eliminated, and unnecessary use applies pressure with no offsetting benefit.

Which antibiotic to use, at what dose and for how long, is a clinical judgement made from the organism and the site of infection. Following the prescribed course, and not using leftover or borrowed medication, is the part that sits with the patient.