Thought I'd chime in with some stellar evolution stuff;
Our star won't explode. About five billion years from now it will have entered its giant phase, becoming a red giant. It will spend about a billion years or so like that, and then shed its outer layers and form a planetary nebula. The Sun will end as a white dwarf, cooling ever so slowly. By cosmic standards it's a very peaceful existence and end.
That doesn't meant life on Earth has five billion years left, though.
In approximately half a billion years the Sun's output will have increased to the level where the Earth's oceans will have evaporated. Life as we know it is difficult to imagine at that point. That's well before the Sun moves into it's next phase, or has even expanded significantly from it's present size. So life on Earth will end long before the Sun swells into a giant. Of course, the oceans won't evaporate overnight, so the period leading up to that means increasing salinity, drier and drier conditions as well as profound changes to atmospheric chemistry. That will likely be a mass extinction bonanza.
So in a geological sense, life on Earth is really on its last leg.
If we are talking about the end of humanity, I'd put my money on (self-inflicted) infertility. That really kills off species in a hurry. Catastrophes like impacts or nuclear war aren't good species-wide killers for diversified creatures like humans, unless they are orders of magnitude larger than humanity's entire nuclear arsenal (ie large asteroid, comet). Other ELEs like those that have happened in Earth's history would likely kill us off in a hurry, but we really don't know much about how those happened (Clathrate Gun hypothesis, oceanic overturns, anoxic events etc, check wikipedia [http://en.wikipedia.org/wiki/Extinction_event] for more on that).
If we are talking about the end of western civilization, I'm inclined to say civil wars and collapsing modes of production (fall of Rome style).