The endosymbiotic theory was first articulated by the Russian botanist Konstantin Mereschkowski in 1905. Mereschkowsky was familiar with work by the German botanist Andreas Schimper, who had observed in 1883 that the division of chloroplasts in green plants closely resembled that of free-living cyanobacteria, and who had himself tentatively proposed (in a footnote) that green plants had arisen from a symbiotic union of two organisms .
Ivan Wallin extended the idea of an endosymbiotic origin to mitochondria in the 1920s. These theories were initially dismissed or ignored. More detailed electron microscopic comparisons between cyanobacteria and chloroplasts (for example studies by Hans Ris), combined with the discovery that plastids and mitochondria contain their own DNA  (which by that stage was recognized to be the hereditary material of organisms) led to a resurrection of the idea in the 1960s.
The endosymbiotic hypothesis was fleshed out and popularized by Lynn Margulis. In her 1981 work Symbiosis in Cell Evolution she argued that eukaryotic cells originated as communities of interacting entities, including endosymbiotic spirochaetes that developed into eukaryotic flagella and cilia. This last idea has not received much acceptance, since flagella lack DNA and do not show ultrastructural similarities to prokaryotes. See also Evolution of flagella.
According to Margulis and Sagan, "Life did not take over the globe by combat, but by networking" (i.e., by cooperation), and Darwin's notion of evolution driven by natural selection is incomplete (see Evolution).
The possibility that peroxisomes may have an endosymbiotic origin has also been considered, although they lack DNA. Christian de Duve proposed that they may have been the first endosymbionts, allowing cells to withstand growing amounts of free molecular oxygen in the Earth's atmosphere. However, it now appears that they may be formed de novo, contradicting the idea that they have a symbiotic origin (Gabaldón et al. 2006).
Evidence that mitochondria and plastids arose from ancient endosymbiosis of bacteria is as follows:
Both mitochondria and plastids contain DNA that is different from that of the cell nucleus and that is similar to that of bacteria (in being circular and in its size).
They are surrounded by two or more membranes, and the innermost of these shows differences in composition from the other membranes of the cell. The composition is like that of a prokaryotic cell membrane.
New mitochondria and plastids are formed only through a process similar to binary fission. In some algae, such as Euglena, the plastids can be destroyed by certain chemicals or prolonged absence of light without otherwise affecting the cell. In such a case, the plastids will not regenerate.
Much of the internal structure and biochemistry of plastids, for instance the presence of thylakoids and particular chlorophylls, is very similar to that of cyanobacteria. Phylogenetic estimates constructed with bacteria, plastids, and eukaryotic genomes also suggest that plastids are most closely related to cyanobacteria.
DNA sequence analysis and phylogenetic estimates suggests that nuclear DNA contains genes that probably came from the plastid.
Some proteins encoded in the nucleus are transported to the organelle, and both mitochondria and plastids have small genomes compared to bacteria. This is consistent with an increased dependence on the eukaryotic host after forming an endosymbiosis. Most genes on the organellar genomes have been lost or moved to the nucleus. Most genes needed for mitochondrial and plastid function are located in the nucleus. Many originate from the bacterial endosymbiont.
Plastids are present in very different groups of protists, some of which are closely related to forms lacking plastids. This suggests that if chloroplasts originated de novo, they did so multiple times, in which case their close similarity to each other is difficult to explain. Many of these protists contain "secondary" plastids that have been acquired from other plastid-containing eukaryotes, not from cyanobacteria directly.
Among the eukaryotes that acquired their plastids directly from bacteria (known as Primoplantae), the glaucophyte algae have chloroplasts that strongly resemble cyanobacteria. In particular, they have a peptidoglycan cell wall between their two membranes.
These organelles' ribosomes are like those found in bacteria (70s).
Proteins of organelle origin, like those of bacteria, use N-formylmethionine as the initiating amino acid.
Primary endosymbiosis involves the engulfment of a bacterium by another free living organism. Secondary endosymbiosis occurs when the product of primary endosymbiosis is itself engulfed and retained by another free living eukaryote. Secondary endosymbiosis has occurred several times and has given rise to extremely diverse groups of algae and other eukaryotes. Some organisms can take opportunistic advantage of a similar process, where they engulf an alga and use the products of its photosynthesis, but once the prey item dies (or is lost) the host returns to a free living state. Obligate secondary endosymbionts become dependent on their organelles and are unable to survive in their absence (for a review see McFadden 2001).
One possible secondary endosymbiosis in process has been observed by Okamoto & Inouye (2005). The heterotrophic protist Hatena behaves like a predator until it ingests a green algae, which loses its flagella and cytoskeleton, while Hatena, now a host, switches to photosynthetic nutrition, gains the ability to move towards light and loses its feeding apparatus.
Neither mitochondria nor plastids can survive in oxygen or outside the cell, having lost many essential genes required for survival. This objection is easily accounted for by simply considering the large timespan that the mitochondria/plastids have co-existed with their hosts; genes and systems which were no longer necessary were simply deleted, or in many cases, transferred into the host genome instead. (In fact these transfers constitute an important way for the host cell to regulate plastid or mitochondrial activity.)
^ Mereschkowsky C (1905). "Über Natur und Ursprung der Chromatophoren im Pflanzenreiche". Biol Centralbl25: 593-604.
^ Schimper AFW (1883). "Über die Entwicklung der Chlorophyllkörner und Farbkörper". Bot. Zeitung41: 105-14, 121-31, 137-46, 153-62.
^ Wallin IE (1923). "The Mitochondria Problem". The American Naturalist57:650: 255-261.
^ Ris H and Singh RN (1961). "Electron microscope studies on blue-green algae". J Biophys Biochem Cytol9: 63-80.
^ Stocking C and Gifford E (1959). "Incorporation of thymidine into chloroplasts of Spirogyra". Biochem. Biophys. Res. Comm.1: 159-64.
^ Margulis, Lynn and Sagan (2001). "Marvellous microbes". Resurgence206: 10–12.
^ McFadden GI (2001). "Primary and secondary endosymbiosis and the origin of plastids". J Phycology37 (6): 951-959.
Bruce Alberts, Alexander Johnson, Julian Lewis, Martin Raff, Keith Roberts and Peter Walter, Molecular Biology of the Cell, Garland Science, New York, 2002. ISBN 0-8153-3218-1. (General textbook)
Jeffrey L. Blanchard and Michael Lynch (2000), "Organellar genes: why do they end up in the nucleus?", Trends in Genetics, 16 (7), pp. 315-320. (Discusses theories on how mitochondria and chloroplast genes are transferred into the nucleus, and also what steps a gene needs to go through in order to complete this process.) 
Paul Jarvis (2001), "Intracellular signalling: The chloroplast talks!", Current Biology, 11 (8), pp. R307-R310. (Recounts evidence that chloroplast-encoded proteins affect transcription of nuclear genes, as opposed to the more well-documented cases of nuclear-encoded proteins that affect mitochondria or chloroplasts.) 
Fiona S.L. Brinkman, Jeffrey L. Blanchard, Artem Cherkasov, Yossef Av-Gay, Robert C. Brunham, Rachel C. Fernandez, B. Brett Finlay, Sarah P. Otto, B.F. Francis Ouellette, Patrick J. Keeling, Ann M. Rose, Robert E.W. Hancock, and Steven J.M. Jones (2002,) Evidence That Plant-Like Genes in Chlamydia Species Reflect an Ancestral Relationship between Chlamydiaceae, Cyanobacteria, and the Chloroplast Genome Res., 12: pp 1159 - 1167. 
Okamoto, N. & Inouye, I. (2005), "A Secondary Symbiosis in Progress?", Science, 310, p. 287
Guenther Witzany (2006), "Serial Endosymbiotic Theory (SET): The Biosemiotic Update", Acta Biotheoretica, 54(1), pp. 103-117
Gabaldón T. et al (2006), "Origin and evolution of the peroxisomal proteome", Biology Direct, 1 (8),. (Provides evidence that contradicts an endosymbiotic origin of peroxisomes. Instead it is suggested that they evolutionarily originate from the Endoplasmic Reticulum)