20 billion years ago there was a huge bang and the universe was created. In time it cooled and congealed from dust and gas into planets and stars, including the Earth and the Sun.
Much later life arose, first in the form of a microbe with the capacity to duplicate itself. Some copies were better than others, some worse, and naturally the better ones made more and better copies of themselves while the poorer ones, by definition, didn't, and died out. Following this pattern, more and more complex life forms gradually arose, leading to bigger and bigger creatures until we get to trilobites, fish, and dinosaurs.
Every seventy or eighty million years or so, great masses of creatures suddenly died out due to some environmental catastrophe - many think that one of the millions of metoerites that orbit nearby crashes into the Earth from time to time and creates climatic havoc, thus killing off the larger and hungrier species and leaving a gap in the ecosystem for smaller ones to grow and flourish.
My own theory is that every seventy or eighty million years some intelligent species springs up, discovers fossil fuels and atomic energy, and creates climatic havoc long before it can build enough Playstations and iPods to leave a detectable layer in its own fossil record.
Either that, or it's just God - younger still than his grumpy Old-Testament self, throwing a tantrum at the inadequacy of his work and starting over.
Right now, we're keeping our civilization going largely through the courtesy of oil - the fossilised remains of ancient organisms - according to science.