Variation exists because heredity is not perfect. Variation arises primarily through random mutations and recombination. All evolutionary changes depend upon changes within populations . Allele frequencies remain constant unless forces change them.
Evolution proceeds at different rates.
The advantage of an allele or genotype depends upon the environment. Speciation generally requires barriers to gene flow. If gene flow among local populations of a species is sufficiently restricted, the populations may so diverge that they will not or cannot interbreed. That is, speciation occurs. If two populations have become different species, the genetic changes in one are usually not transmitted to the other, so they pursue independent evolutionary paths.