Speciation is the process through which new species arise from already existing ones. In the process of speciation, both genetic drift and natural selection are crucial. Natural selection is the process through which nature chooses features that are advantageous to the species in a particular environment.
For example, beetles change their colour when they reproduce. In the offspring, one beetle instead of developing its typical red colour acquires a green one. This beetle may pass on this colour variation to its offspring, ensuring that all of them are green in hue. Crows continue to consume red beetles, which are easily seen on green leaves, even though they can’t easily spot green-colored beetles on the green leaves of bushes. As a result, each region sees a rise in the population of green beetles.
When a part of the population dies in a natural disaster or migrates to another area, genetic drift occurs, which results in the removal of the genes for specific traits from the tiny group. It modifies the surviving population’s gene frequency.
Suppose in a sexually reproducing red beetle population, a colour variation arises wherein one beetle develops blue body colour instead of red. This beetle can also pass this colour variation to its progeny so that all its offspring are blue-coloured beetles. As the population of beetles expand, initially there would be few blue-coloured beetles among the majority of red-coloured beetles. At this point, an elephant comes by and stamps on the bushes where the beetles live. Consequently, most of the beetles get killed. By chance, most of the surviving beetles are blue. This population again slowly multiplies and will contain mostly blue-coloured beetles over some time. Survival of more blue beetles in the population changed the coloured characteristic from normal red to blue over some time. In a small population, accidents can change the frequency of some genes a population, even if it does not give any survival advantage to the possessors.