How does natural selection work?
General speaking, something must cause differential reproduction and then better suited individuals will survive over time.
Natural selection is the process in which individuals whom are better suited to their environment will have an increase in fitness. It occurs over multiple generations and can take a very long period of time to occur.
For natural selection to occur, the following must be true:
1. There must be variation in traits (every individual can't be identical)
2. There must be differential reproduction (some individuals are more likely to reproduce than others)
3. Traits are passed on from generation to generation
Thus, the first step in natural selection is that something must cause differential reproduction. This could be the introduction of a predator, a disease, a random mutation that is detrimental, a change in resource availability such as a drought, and so forth.
This image shows how a genetic mutation is unfavorable and is selected against, but the same process holds for a gene that is unfavorable during any scenario.
This event causes some individuals to survive and reproduce and some to be less successful. For example, a predator is introduced and it hunts and kills mostly individuals with shorter legs that run slowly. Or the environment undergoes a long drought and individuals in the species who have a gene that helps them perspire (sweat) less are more successful.
Over multiple generations, the genetic composition of the species changes. Maybe within six generations the predator has completely wiped out individuals with shorter legs. Maybe within two generations the drought completely eliminates individuals with a gene that results in excess perspiration. The amount of time will vary.