The End
Life on Earth has about 1.5 billion years left.
At that point, the sun will have grown in size to the point its heat output will basically make life uninhabitable for the planet. In another 3.5 billion or so years after that the sun will go supernova, expanding and swallowing our planet and most of the solar system before exploding brilliantly.
We won't be here for that, so no worries.
Humanity - at least in our somewhat modern way of defining it - has only been around for about 315,000 years (near as we can tell). Relative baby steps, really. And during that time we've succeeded in killing off 85% of all other mammals and over 50% of all plant species on the planet, many of whom had been around for millennia before us. Obviously we're making the most of our time; not even a half a million years and we're doing the sun's job much quicker than it ever could. Moreover with human-made climate change in the works we're killing off the remaining species at record rates, and guesses are that maybe a whole third of what's left will die in the next few decades. There are some who worry the mass extinction we've caused - the first caused by a species, go us! - will cause our overall ecosystems to collapse and spell our doom, but they're probably alarmists. "Humans are resilient" - not like all those other species we destroyed.
Guesstimates think we could hit "peak human" at around 10 billion people; we've hit 8 billion recently, so another couple 'bill doesn't sound so difficult. In just the space of 40 years, between 1959 and 1999, we doubled our total population from 3 billion to 6 billion - like the blink of an eye, look at us horny little buggers go! Past 10 billion however and scientists get a bit concerned we'll run out of things like freshwater and food, assuming we all do the unthinkable and go vegetarian to maximize the planet's resource production. But we'll probably hit that mark they say in another thirty to fifty years so we'll get to see how that theory pans out. Lucky!
Still, most mammals before we slaughtered them lasted about 1 million years before they went extinct from natural causes; assuming that's our lot then we've got a little under 700,000 years left. Again, waaaaay before the sun heats things up worse than we have, phew.
And if you're worried about climate change or pollution don't be; these things may reduce the overall human population but obviously we're on track to grow anyway. We're not looking at the quality of life on Earth, just the possibility of it. Sure whole sections of Earth may become uninhabitable - heck, we'll pack it in! - and we may be reduced to relying on a much more limited catalog of species to support us - that's what gene cloning is for! - and our ability to survive may become reliant upon technology more than most of us are comfortable with - nanobots and gene splicing for the win! - BUT the important thing to remember here is life goes on. Regardless of whether you're horrified or not, whether you'll be part of the tiny majority that can afford to survive when it becomes much more expensive to do so, or whether you believe in any of that nonsense and think things will carry on the way they always have (you're totally right! they will!) - the bottom line, again, is that humanity will make it. Maybe not forever, maybe not happily, but after all is said and done at least it'll have its day in the sun.
Oh, sorry - under the sun. Sun doesn't swallow us whole for another 4.5 billion years, remember? Gosh, semantics. I hope we kill that shit next.