The emergence of a new species is an important event in evolution. Typically, it's a slow process where two populations gradually become more and more different from each other until they can no longer interbreed. For populations to diverge like this, they have to be genetically isolated -- in other words, they have to mate with each other seldom or never. Without genetic isolation, mating will bring about the exchange of genes between the populations and minimize differences between them so they do not diverge. Populations can become genetically isolated from each other in several different ways.
The simplest kind of genetic isolation is through allopatry, or geographic separation, where two populations are separated by some kind of physical barrier so they're unable to exchange individuals and mate. If a seed from a plant gets carried away by the wind and ends up hundreds of miles from its parent plant, for example, it will found a new population that can't interbreed with the old because they're just too far apart. Now the two populations can gradually diverge and evolve until they become so different they are different species. The most famous example is the finches of the Gallapagos Islands. Finches are only very rarely able to cross from one island to another because of the ocean water, so populations on different islands are largely isolated and have gradually evolved into separate species.
Sometimes there are no physical barriers to mating but a population can gradually split up into genetically isolated groups because individuals are more likely to mate with their near neighbors. This kind of process is called parapatric speciation. One observed example is Anthoxanthum odoratum, or buffalo grass. Some varieties of the grass are more tolerant of heavy metal pollution than others and thus can grow close to mines with polluted soils. Although these varieties could in theory interbreed with buffalo grass in other unpolluted regions, in practice they tend to breed exclusively with close neighbors, so the varieties that flourish near mines are gradually diverging from other populations.
In sympatric speciation, a sub-population gradually becomes genetically isolated because it's exploiting a new resource in its environment. The most common example is the apple maggot. Originally, these flies laid their eggs only on hawthorns, but when the American colonists introduced apple trees, the flies began to lay their eggs on these too. In general, however, females of this species like to lay their eggs on the same kind of fruit they grew up on, and males seem to prefer females that like their type of fruit. So males and females that grew up on hawthorns tend to mate with each other, but not with males and females that grew up on apples. Over time, these preferences have gradually led to the emergence of two separate sub-populations that are genetically different from each other even though they share the same territory.
Mechanisms of Evolution
Once two populations are genetically isolated, they can diverge through one of two mechanisms: natural selection or genetic drift. In natural selection, environmental pressures like disease or limited resources ensure that individuals with certain genes leave behind more offspring than others. Consequently, those genes become more common in the population over time. In genetic drift, by contrast, a random event like a hurricane wipes out individuals non-selectively so that some genes become more common while others are eliminated -- not because those genes are better or worse than the others, but because a random event wiped out the individuals carrying them. One common example of genetic drift is the founder effect, where a few individuals strike out on their own and form a new population. Even if the genes these individuals carry were uncommon in the old population, they will now be common in the new.