Charles Darwin developed the theory of evolution by natural selection after traveling around the world on the HMS Beagle and observing organisms on the Galapagos Islands. His theory proposed that organisms evolve over generations through natural selection, where individuals with traits best suited for their environment survive and reproduce, passing on those favorable traits. Examples like the Galapagos finches and tortoises showed how isolated populations on the islands evolved different traits adapted to the local environment over time. The key factors in natural selection are overproduction of offspring, genetic variation between individuals, competition for limited resources, and the selection of individuals with traits better suited for the environment to reproduce and pass on their genes.