Hard to tell, but chances are it will be a result of our own doing. Probably climate change as the big factor but also just the general shittyness of the human race, and the corruption of government/corporations. I think it will go something sort of like this and probably happen in the next 100 years if nothing is done about climate change and corruption:
- Climate change causing more and more deadly storms and extreme heat. Lots of hurricanes and rain storms and mega thunderstorms, etc almost everywhere. Also add in the mix, general civil unrest. Things in general just seem to be getting worse and worse. Governments and corporations being more and more corrupt, more violence and crime etc... Then throw in the great reset and agenda 2030 which will really rile things up.
- As things progress, more and more places will become simply inhabitable, either due to too many storms, too hot, or even completely under water. Climate change will be exponential at this point since some of the side effects are tons of methane being released as permafrost is mostly all melted. There will be no turning back now.
- Population pushing into areas that are more livable. This will cause lot of civil wars and fights, lot of people will be killed from this, lot of fighting for land etc. Land ownership will mean nothing, people will just force their way on your land and nothing you can do, government may even force it too, ex: if you own acreage they will just take it away to build housing. 1 world government will probably start to form around this point, if the rapture is going to happen it will be around this time. Let's not even get into the fact that there will be hardly no jobs or wealth at this point. Only a few megacorporations that control everything. Think, Ecorp from Mr. Robot. You're either poor, or you are one of the few elite rich running the world. The mark of the beast will be introduced and basically be the only way you can get basic resources like food. It will probably have to do with phones. Maybe an app you have to install that links to something you need to do to your body like a chip implant or special tattoo, or something. Basically having this app will be a requirement for anything.
- More and more places becoming inhabitable and more and more deadly storms so people crowding livable places more and more and more and more violence as a result. At this point even the government and corporations will start to lose control and it will mostly be anarchy. There will only be a few mega cities at this point, in the few areas that are habitable, but even those will be getting pretty bad due to the storms and violence etc. Constant fires, crumbling buildings etc. Very very hot, and lots and lots of storms. Constant rain, thunder storms, hurricanes etc. It will basically just be a way of life to deal with this weather all the time and it will be pure hell.
- At this point the population will be quite low, maybe a few million and even the government will be gone. People will basically be either fighting, or giving up and committing suicide. Or just letting themselves die. There will hardly be any resources. Maybe some micro communities trying to grow stuff in buildings that have been untouched. But mostly it will be everyone for themselves in what is going to be a non stop war against nature and other humans, with very scarce resources.
- At some point there will be a couple people left that will be spread out and not really know about each other but they'll probably figure they're the last remaining human, and contemplate suicide for a long time before finally giving in and doing it. Or just die by natural causes such as starvation. At this point Earth will have no humans left.
-If there is anyone on the moon or Mars by then like we have on the ISS today, they may be the last remaining humans and survive through all of this, but without any support from Earth, things will be hard and by then there may not be enough of them out there to try to fully colonize so they will eventually die off, probably from lack of resources. Depends how far they are at that point in making them self sustained. At some point there will be one human left at that base/station. Imagine the psychological impact of realizing you are the last human to ever exist and you have nobody to interact with, and never will have, and you're not even on earth. That person will probably also just off themselves.
-Meanwhile, things on Earth will be very stormy for a long time, maybe another 100 years, but eventually things will stabilize and maybe even cool slightly but still be warmer than it is now. At this point Earth will be a dead planet that has water but the continents will be mostly unrecognizable. Some micro organisms may survive and remain, but that will be about it.
The end!