Warfarin is the active ingredient in rat poison. Random mutations in the genomes of rats mean that some rats in a population have a natural resistance to warfarin. This causes variation in the rat population.
Rats which are resistant have a selective advantage over other rats in the population – they will survive to breed, whereas those without the gene will not. This is known as survival of the fittest.
The genetic mutation that gives resistance to warfarin is passed along to the next generation. Because rats without the mutation are unable to survive, there is less competition for resistant rats and they will thrive.
The gene will eventually become common in the population, and the warfarin will no longer work as effectively as a rat poison.