Since the Earth has finite resources, there is a limit to the number of people the Earth will support. The ideal size of the population should be much smaller than the absolute limit, since I think everybody should have enough material resources for a decent life, and resource usage should be sustainable indefinitely. But any number I put out will still be a guess. But I will take the risk and make a guess.
I am going to say that the ideal human population for the world is around 2 billion. The current population is about 7.5 billion, so that is a very large drop. It would probably take a couple of centuries to reach this level with disaster or coercive measures. Though the population first reached 2 billion only around 1927.
With a population of 2 billion, the strain on Earth’s resources would be greatly eased. The most efficient locations for renewable resources, whether agriculture, solar and wind power, or fisheries, would be enough to support the population in material comfort. Biomass could be used as raw material for plastics, and other synthetic materials, which would be designed to be biodegradable. Land would be relatively cheap, and it would be far easier to preserve wilderness areas.
I am convinced that this number could be reached with non-coercive methods and without disasters such as famine or disease. By far the most important thing is to give all women control over their reproduction. This implies that women should have full civil rights and education in order to exercise this right. These things are the right thing to do even if population was not an issue. Recent history has shown that giving women control and increased economic prosperity leads to falling birth rates.
I could not find many other estimates of the ideal population. Such estimates depend on what kind of life you expect for people and are inherently speculative. I did find one guess on a Web site for an advocacy group on overpopulation, World Population Balance, that also ended up at 2 billion. I would be interested in what the opinion of readers are on this question.