The complex relationships between infectious organisms and their hosts often reflect the continuing struggle of the pathogen to proliferate and spread to new hosts, and the need of the infected individual to control and potentially eradicate the infecting population. This has led, in the case of mammals and the pathogens that infect them, to an 'arms race', in which the highly adapted mammalian immune system has evolved to control the proliferation of infectious organisms and the pathogens have developed correspondingly complex genetic systems to evade this immune response. We review how bacterial, protozoan and fungal pathogens from distant evolutionary lineages have evolved surprisingly similar mechanisms of antigenic variation to avoid eradication by the host immune system and can therefore maintain persistent infections and ensure their transmission to new hosts.