Resistance genes don't drift around on their own. They ride on mobile genetic elements, and those elements supply both the machinery to move the genes and the machinery to express them.
Start with plasmids. A plasmid is a circular piece of DNA that sits outside the chromosome and copies itself independently of it. Conjugative plasmids also carry a transfer region, the tra genes, which builds the mating pilus and handles the handoff of DNA to another cell. Because one plasmid can hold several resistance genes, a single transfer event can deliver resistance to more than one drug at once.
Transposons move DNA around inside a cell. A transposon is a DNA segment that can shift from one location to another, either within a genome or between a plasmid and the chromosome, in both directions. It carries the gene for transposase, an enzyme that recognizes the inverted repeat sequences at the two ends of the transposon and cuts the segment out and back in somewhere else. That hopping matters because it can settle a resistance gene permanently in a new host, or move it onto a conjugative plasmid where it can travel further.
Integrons do the collecting. An integron is a genetic element that captures and expresses gene cassettes, and many of those cassettes are resistance genes. It encodes an integrase, which inserts cassettes at one specific attachment site called attI, plus a promoter that drives expression of whatever has been captured. Cassettes slot in one after another, in tandem, so a single integron can pile up several resistance genes and read them all as one transcript. That is how one integron builds a multidrug resistance array.
The three elements operate as a system. A transposon can pick up a loaded integron and carry it onto a conjugative plasmid, and the plasmid then transfers the whole assembly into a new bacterium. This nested arrangement, plasmid holding transposon holding integron holding cassettes, is why resistance genes cluster together and spread as a single unit.