We wouldn't have mitochondria or chloroplasts (OK, plants wouldn't have chloroplasts) without some serious evolution resulting in endosymbiosis. Endosymbiosis is a term for when one organism lives inside another one, and it is a mutually beneficial relationship. Consider the role of a parasite living inside another organism and you see why that last part is important.
Eukaryotic cells came about through endosymbiosis and evolution. Once upon a time, all cells were prokaryotic and were pretty simple—no membrane-bound nucleus, no mitochondria or chloroplasts, and simpler DNA.
At some point long ago in evolutionary history, some prokaryotes started living inside of other, larger prokaryotes. This probably happened when the larger cell tried to eat the smaller organism and it didn't die. Over many generations, this emerged as a mutually beneficial relationship to the point where neither organism could live without the other. The smaller organism became a mitochondrion, and today mitochondria exist in all eukaryotic cells.
Endosymbiosis happened something like this:
The same process happened with chloroplasts, which are the organelles responsible for photosynthesis. Obviously not all cells have chloroplasts, or else humans and other animals would have much greener skin. Because mitochondria are present in all eukaryotes, and chloroplasts are only present in some, we can deduce that the evolution of chloroplasts happened after the evolution of mitochondria.
How do we know mitochondria and chloroplasts evolved this way? A few ways: first, both mitochondria and chloroplasts have their own circular DNA. Prokaryotes typically have circular DNA genomes, unlike the linear chromosomes found in eukaryotes. This supports the idea that the ancestors of both organelles were free-living prokaryotes that were engulfed by another organism.
Second, mitochondrial DNA is similar to DNA of some bacteria (the alpha proteobacteria, in case you were wondering). Coincidence? Unlikely. The best explanation is that mitochondria and protobacteria share a common ancestor. Similarly, chloroplasts and cyanobacteria share a common ancestor.
Third, mitochondria and chloroplasts have inner membranes with transport systems that are similar to the transport systems found in some prokaryotes.
Fourth, other symbioses exist on Earth these days, so we know that two organisms can live together and depend on each other. All the E. coli in our guts, for example, help our digestive system in exchange for a free place to live.
Early organisms in the history of life on Earth probably used glycolysis as their main form of energy production, and it has been handed down to all of the descendants of those early life forms. In the early days of life on Earth, the atmosphere did not have a lot of oxygen, so it makes sense that cellular metabolism did not require oxygen.
The citric acid cycle and oxidative phosphorylation could not have evolved before mitochondria were established, which was close to 2 billion years after prokaryotic cells arose. So even though we like to think of ourselves and human society as pretty advanced, we still use the ancient process of glycolysis in our cells.
When it comes to cellular respiration, it is pretty clear that the theme of unity and diversity is relevant. Despite the variety of life forms we have on Earth, one thing remains the same among them, and that is glycolysis. Glycolysis unites diverse organisms, as it happens in almost every group of organisms alive today.
The other parts of cellular respiration, the citric acid cycle and oxidative phosphorylation, are shared by all eukaryotes and many prokaryotes. These organisms are further united by their energy metabolism.
All cells need energy, no matter if they are the entire organism or one cell among millions. The fact that all eukaryotes carry out cellular respiration is pretty impressive. Humans, seagulls and mushrooms are all doing the same thing when it comes to breaking down glucose. To add to the excitement, metabolic processes can break down a diverse range of carbohydrates, proteins, and fats by converting them to glucose before cellular respiration.
Vibrio chlorae, the bacterium that causes cholera, uses anaerobic respiration as its metabolism.
Only eukaryotes have mitochondria, though, so how the heck do prokaryotes get energy? They don't have the fancy citric acid cycle pinball game in their cells. Prokaryotes are diverse in their metabolisms.
Some prokaryotes are photosynthetic, and also use an electron transport chain to make ATP. Cellular respiration may actually have evolved from modifying photosynthetic processes to extract energy from food.
Other prokaryotes are diverse in their metabolisms; some need oxygen, others can live without it. Organisms that do not use oxygen in their metabolism are called anaerobes. Anaerobes are a large, diverse group. Some anaerobes live by fermentation and others use different electron acceptors, such as nitrate or sulfate ions, at the end of their electron transport chains. Some prokaryotes fix nitrogen (N2) from the atmosphere and make ammonium from it. Others use a metabolic process called nitrification, oxidizing ammonia to nitrite. Another possible metabolism is denitrification, which reduces nitrate to nitrite. Although these are diverse forms of metabolism, they are united by redox reactions that allow energy transfers to be made.
Some bacteria that live in the ocean use oil for their energy—usually, they metabolize naturally-occurring oil but they can also be used to clean up oil spills. Other prokaryotes reduce sulfate, and some oxidize hydrogen gas to make methane.