There are a few basic ways in which microevolutionary change happens. Mutation, migration, genetic drift, and natural selection are all processes that can directly affect gene frequencies in a population.
Imagine that you observe an increase in the frequency of brown coloration genes and a decrease in the frequency of green coloration genes in a beetle population. Any combination of the mechanisms of microevolution might be responsible for the pattern, and part of the scientist’s job is to figure out which of these mechanisms caused the change:
Some “green genes” randomly mutated to “brown genes” (although since any particular mutation is rare, this process alone cannot account for a big change in allele frequency over one generation).
Migration (or gene flow)
Some beetles with brown genes immigrated from another population, or some beetles carrying green genes emigrated.
When the beetles reproduced, just by random luck more brown genes than green genes ended up in the offspring.
Beetles with brown genes escaped predation and survived to reproduce more frequently than beetles with green genes, so that more brown genes got into the next generation.