Charles Darwin could see that natural selection was the cause of evolution, but explaining properly had to wait for the discovery of the science of genetics.
Charles Darwin believed that the variation needed for natural selection to work came from what he called 'sports', equivalent to what we now call mutations.
The basic principle of evolution is that natural selection acts when changed conditions operate on chance mutations either existing or arising in a population.
From this viewpoint, evolution by natural selection is all about the changes in gene frequencies in a population after some condition or conditions change.
Charles Darwin found one major problem with his theory of evolution by natural selection because he believed inheritance operated by blending parental forms.
In blending inheritance, if you pollinate a red flowered with pollen from a white flowered plant, the seeds will develop into plants with pink flowers.
Blending inheritance is quite rare in nature, and Gregor Mendel knew this soon after Charles Darwin first published his theories on natural selection.
Because nobody took any notice of Gregor Mendel's work for many years, blending inheritance remained a problem for those who adopted Charles Darwin's ideas.
With blending inheritance assumed, people thought from this that any new mutation would be immediately 'swamped' by the normal genes in the same population.
In 1929, R. A. Fisher published his book 'The Genetical Theory of natural selection', which made an explicit link between Darwinian evolution and genetics.
In 1931, Sewall Wright linked selection pressure, mutation rates, inbreeding, and isolation, and proposed genetic drift, which he developed the next year.
In 1932, Sewall Wright outlined genetic drift, an effect caused by the chance loss of alleles in small populations, without selection being involved.
In 1939, Julian Huxley introduced the concept of the cline in evolutionary variation, a regular variation in gene frequencies with changes in the habitat.
Today, genetics is an important part of evolution, because it allows us to apply information from genomics when we want to measure how species are related.