There is speculation about this, that is problem. Nobody talks about previous cycles repeating themselves. Let us remember that in the end the earth will die from the cold, the sun is not eternal
My understanding is that most stars, including those like the sun, get brighter with age. This is gradual their whole lives, and then dramatically towards the end when they swell up into red giants and swallow their planets.
en.wikipedia.org
When the earth and sun first formed, the sun was probably 30% dimmer than it is today. Before the dawn of plants and animals 600 million years ago, when all life on earth was microbial, the Earth would have crazy ice ages... they were so severe to freeze over the oceans all the way the equator! These 'snowball earth' episodes lasted a long time, bc the ice reflected heat into space very effectively, until volcanic CO2 finally built up and the ice got melted.
en.wikipedia.org
When the ice DID melt, there was so much CO2 in the air (bc it couldn't dissolve in the ice covered ocean) that the earth got rapidly warmer. We can suppose that there was a surge in rainfall, erosion, wave action, and the seas not only warmed, they got a surge of nutrients and sunlight all at the same time. The last of these melting events was 600 million years ago, and coincided with the Cambrian Explosion and appearance of all the major Phyla of life today in a short period.
The lack of snowball episodes since then is probably due to the sun finally getting bright enough to cross a key threshold.
There is another problem. As the sun gets brighter, to keep the same climate (over hundreds of millions of years) the Earth will need to have less and less greenhouse gases. We can estimate that sometime in the next few hundred million years, it will not be possible to have the current climate even if we had ZERO CO2 and methane in the atmosphere (assuming water vapor is still present).
So the earth's climate as we know it will not last more than a few hundred million years more, even though the sun will burn 5000 million years more, remorselessly baking the earth for 90% of that time.
So, bc the sun's output is NOT constant, the Earth only gets about a billion years in its current form suited for (non-microbial) life. Before that it is too cold, and the mega ice ages would wipe out the entire ecosystem on land (glaciers everywhere) and in the oceans (no oxygen or sunlight). After that the sun is just too hot and the climate runs away. Our Earth is currently about 2/3rds of the way through this goldilocks period.