Natural selection is the primary mechanism within the scientific theory of evolution, i.e. it alters the frequency of alleles within a population. After a century of obscure and vague preliminary formulations, it was proposed as the main mechanism of evolution by Charles Darwin and Alfred Russel Wallace in 1858. Natural selection can be subdivided into two types; ecological selection, and sexual selection. Natural selection is distinguished from artificial selection by humans. Other mechanisms of evolution include genetic drift and gene flow. Mutations create the genetic variation on which natural selection acts.
It is important to note that the term "natural selection" is often used in the inaccurate yet fairly harmless metaphorical sense as having causal status. To be precise, natural selection is not truly a "mechanism" in itself, as opposed to something like gravity. Instead, natural selection is the result of genetic and environmental forces acting upon an organism.
The basic concept of natural selection is that conditions (or "nature") determine (or "select") how well particular traits of organisms can serve the survival and reproduction of the organism; organisms lacking these traits might die before reproducing, or be less prolific. As long as environmental conditions remain the same, or similar enough that these traits continue to be adaptive, such traits will become more common within populations. Loss of the species' ecological niche or crowding-out due to population growth can change drastically the adaptive traits required to survive - in such conditions, or in any circumstance where survival is determined by ecology more than by the secondary sexual characteristics, an ecological selection is taking place (this term is used solely to differentiate processes irrelevant to mating, and is of modern usage, having grown up with the field of ecology itself).
Darwin's scientific theory of the evolution of species through natural selection starts from the premise that an organism's traits vary in a non-deterministic way from parent to offspring, a process called "individuation" by Darwin. This theory does not make any specific claims as to how this process works, although more recent scientific discoveries in genetics explain several mechanisms that occur in the process of reproduction: in the case of both asexual and sexual reproduction, random mutation (including DNA transcription errors); in the case of sexual reproduction (which mixes the DNA of two parents into an offspring), gene flow and genetic drift are also important mechanisms. Competition (typically among males to impregnate females) for mates produces sexual selection - a process which Darwin considered secondary to ecological in most species.
Natural selection does not distinguish between ecological selection and sexual selection, as it is concerned with traits, e.g. dexterity of movement, on which both may operate simultaneously. If a particular variation makes the offspring which manifest it better suited to survival or to successful reproduction, that offspring and its descendants will be more likely to survive than those offspring without the variation. The original traits, as well as any maladaptive variations, will disappear as the offspring who carry them are replaced by their more successful relatives.
Therefore, certain traits are preserved due to the selective advantage they provide to their holders, allowing the individual to leave more offspring than individuals without the trait(s). Eventually, through many iterations of this process, organisms will develop more and more complex adaptive traits.
What makes one trait more likely to succeed is highly dependent on environmental factors, including the species' predators, food sources, abiotic stress, physical environment, and so on. When members of a species become separated, such as geographically, they face different environments, and tend to develop in different directions. After a long period of time, their traits will have developed along different paths to such an extent that they can no longer interbreed, at which point they are considered separate species. This is why a species will sometimes separate into multiple species, rather than simply being replaced by a newer form of the species (from this fact Darwin suggested that all species today have evolved from a common ancestor).
Additionally, some scientists have theorized that an adaptation which serves to make the organism more adaptable in the future will also tend to supplant its competitors even though it provides no specific advantage in the near term. Descendants of that organism will be more varied and therefore more resistant to extinction due to environmental catastrophes and extinction events. This has been proposed as one reason for the rise of mammals. While this form of selection is possible, it is more likely to play an important role in cases where selection for adaptation is continuous. For example, the Red Queen hypothesis suggests that sex might have evolved to help organisms adapt to deal with parasites.
Natural selection can be expressed as the following general law (taken from the conclusion of The Origin of Species):
The result is the evolution of species.
Note that this is a continuing process -- it accounts for how species change, and can account for both the extinction of one species and the creation of a new one.
Note also that the above law need not apply solely to biological organisms; it applies to all organisms that reproduce in a way that involves both inheritance and variation. Thus, a form of natural selection could occur in the non-biological realm (see, for example, Genetic programming). Note also that this formulation does not rule out selection occurring at all biological levels (e.g. gene, organism, group). Finally, note that the particular process of introducing new traits does not matter. Darwin first outlined his theory in two unpublished manuscripts written in 1842 and 1844 and more fully developed it for publication in The Origin of Species, especially Chapter 4. In this chapter he wrote:
Darwin ends his book with an often quoted passage: "There is a grandeur in this view of life, with its several powers, having been originally breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and wonderful have been, and are being, evolved."
Charles Darwin's discovery of the principle of natural selection, as his explanation for the origin of species, occurred in about 1838. Over the next twenty years, he shared it with only a very small number of acquaintances, while he amassed evidence in its favor. In 1858, Alfred Russel Wallace independently discovered the principle, and wrote a letter to Darwin, explaining his hypothesis. This prompted a reading, at the Linnean Society, of tracts from both men describing the principle that year. Darwin published his detailed theory the following year, in The Origin of Species.
Unbeknownst to both Darwin and Wallace, the principle of natural selection had been previously hypothesized by others. Pierre Louis Moreau de Maupertuis in 1745, Erasmus Darwin in 1794-1796, Patrick Matthew in 1831, and William Charles Wells in 1813, were amongst the first to grasp the idea. Maupertuis' discovery is in dispute, but has enough substantial evidence in its favor to warrant mention here. Erasmus Darwin was a contemporary and colleague of Wells — not to mention the grandfather of Charles Darwin — and he expressed much of his theory of evolution in poetic verse. His formal exposition of the hypothesis lacks a structured formulation, but has enough merit to be considered a possibility. Matthew's hypothesis had appeared in an appendix to his book on arboriculture; Wells' hypothesis, applied solely to explain the origin of human races, had been presented in person at the Royal Society. Richard Owen also claimed precedence over Darwin. Edward Blyth had also proposed natural selection, as a mechanism of keeping species constant.
Perhaps the most radical claim of Darwin's theory of evolution through natural selection is that "elaborately constructed forms, so different from each other, and dependent on each other in so complex a manner" have evolved out of the simplest forms of life and according to a few simple principles.
It is this fundamental claim that has inspired some of Darwin's most ardent supporters--and that has provoked the most profound opposition. Some groups prefer to believe in divine intervention or guidance of the process, such as those favoring the Intelligent design school of thought. In addition, many theories of Artificial selection have been proposed to suggest that economic or social fitness factors assessed by other humans or their built environments are somehow biological or inevitable - Social Darwinism. Others held that there was an evolution of societies analogous to that of species. Darwin's ideas, along with those of Smith and Marx, are considered by most historians to have had a profound influence on 19th century thought, and to have challenged the rationalist and religious fundamentalist schools of thought that prevailed in Europe.