A population will always have some level of genetic variation for a specific character, giving different variants of the same character. Some characters are essential for fitness and influence survival, these are subject to selective pressures, meaning that the variants of that character will either spread or disappear from a population depending on the survival advantage or disadvantage they provide. This is simply because the individuals with the most advantageous variant will survive more and reproduce more, so in the next generation a bigger proportion of the population will have that advantageous variant.
For example, Peppered moths are either black or white with black speckles. Before the industrial revolution most of the population of peppered moths were white because they used their colour as a camouflage as it was the same colour as tree bark. They were more difficult to spot, and thus better protected from predators. But during the industrial revolution, soot from factories made the trees black, making the white moths easier to spot and camouflaging the black ones. The gene coding for the black colour became advantageous around cities, and was selected for. The gene spread through the population as black moths had a better chance of surviving and reproducing.