Here’s how allopatric speciation operates.
You start with a population of organisms, that are all members of the same species. Each individual in that population, can choose a mate from the rest of the population, and if successful, can produce fertile offspring with that choice of mate.
Now, an event occurs that results in the population being split in two. Call these new, separated populations A and B.
The event in question could be the emergence of a physical barrier preventing the two populations from meeting, or it could be the emergence of a behavioural trait resulting in what is known as “assortative mating” taking place between two different phenotypes in the population. The exact details of the barrier don’t actually matter - what matters is that a barrier comes into existence between the two populations.
Because there is no gene flow between the newly separated populations, there is no magic force compelling those populations to be genetically identical to each other from that point on. The populations will diverge from each other as a result.
Indeed, the two separated populations need not be genetically identical at the start, and almost certainly won’t be. Hypothesise, for example, that your organisms can have either blue or red spots on the side of the body, and that this trait is controlled by a single gene. There almost certainly won’t be an identical number of blue-spotted and red-spotted individuals in each of the separated populations to begin with (it would be a pretty remarkable occurrence if this were the case), and so, the two populations will not even start as genetically identical with respect to this one gene alone. Repeat this for every gene with multiple alleles, even if they don’t result in an easily observable phenotye, and you quickly realise that the separated populations will begin with differences in place.
Those differences will, of course, increase with each new generation in the separated populations.
Eventually, those differences will reach the point where individuals from population A, will be unable to produce fertile offspring with individuals from population B. We now have a speciation event in place.
Now matters get slightly complicated at this point. If we conduct a genetic audit trail, and arrange for pre-split ancestors to be preserved in a manner allowing their revival, we could find ourselves with the following scenarios:
[1] Population A can produce fertile offspring with its ancestors, but Population B cannot. Population A therefore retains its original species identity, and Population B acquires a new species identity.
[2] The roles of the two populations above are reversed. In this case, Population B retains its original species identity, and it’s Population A that acquires a new species identity.
[3] Both Populations A and B fail to produce fertile offspring with their original ancestors. The original species has effectively disappeared, and we have two new species in their place. But, because ancestors of the original species are still alive, this is characterised as a “pseudo-extinction”. A species only truly becomes extinct, when it leaves no descendants.
Incidentally, scientists know which genes are likely to trigger speciation events as they diverge. An important class being the Major Histocompatibility Complex (MHC) of genes - these are the immune system genes responsible for distinguishing between “self” and “non-self” when, for example, bacteria infect organisms, and are responsible for tissue types. MHC genes are among the quickest to diverge when populations split.
Related, albeit somewhat distantly, are the fertilin genes, which are genes responsible for determining egg and sperm compatibility. These actually form part of an extended family of genes known as the ADAM genes (in this case, ADAM is an acronym for “A Disintegrin And Metalloproteinase Domain”, which is a common feature of these genes). That domain allows the gene products to adhere to various cell substrates, and genes in this family are responsible for a range of cell-cell and cell-matrix interactions.
For example, muscle formation and neurogenesis (formation of parts of the central nervous system) are all mediated by genes in this family. In the case of humans, the ADAM2 gene (also known as fertilin beta) is part of the outer integument of sperm cells, and plays an important role in interactions between sperm and egg. Mutations in this gene will of course ultimately lead to fertility changes in a population, and homologues/orthologues of this gene an be found pretty much across every lineage of organisms that rely upon sperm and egg based reproduction.
So endeth my quick guide to allopatric speciation. 