The end of life on Earth will happen slowly, over a period of billions of years, and it will be caused by changes in the sun. The sun has been increasing in luminosity throughout its lifespan and will eventually render Earth too hot to sustain organic life.
As the sun grows hotter, the amount of energy reaching Earth steadily increases. In about 600 million years, the increased energy input to Earth's climate will have driven silicate weathering to the point that most of the carbon will have precipitated out of the atmosphere. At this point, the type of photosynthesis used by trees will no longer be possible, though certain plants that use a different chemical pathway will continue photosynthesizing until carbon levels fall below 10 parts per million. At that point, all plant life will cease along with most animal life, which is dependent on plants for energy.
In approximately 1.1 billion years, solar radiation will be 10 percent higher than present levels. The oceans will evaporate and form a Venus-like "moist greenhouse" that is almost certainly incompatible with life. With the loss of the ocean, plate tectonics will likely stop, and the magnetic field will diminish. Without a magnetic field, Earth will gradually lose atmosphere to space until the final end, which will come in 7 billion years, as friction from the red giant sun's atmosphere slows Earth in its orbit and causes the planet to spiral into it.