The numbers are astronomical, like grains of sand.

It is evident that astronomers cannot count stars, planets or galaxies. But they can make calculations, based on logical assumptions and measurements.
This type of calculation has several difficulties that we must keep in mind:
1-In galaxies there are stars, planets, asteroids, comets; gas and dust; dark matter. Astronomers generally disregard planets and minor objects in the mass calculation, considering that their mass is much less than that of the stars. The mass of galaxies can be calculated by their rotation and the brightness of the components. Since the rotation is greater than the mass of the luminous objects, it is thought that there is dark matter in galaxies and the stellar mass/dark matter mass component can be calculated.
2-Everything we see, we perceive it as it was in the past and not as it is "right now", since light takes time to reach us. The farther away we observe, the further in the past the emitting object is located. This implies that if calculations are made based on such observations, it will be a calculation that will include objects that very likely no longer exist, particularly when dealing with the universe on a large scale. Furthermore, the results will not include newer objects, whose light has not yet reached the observers.
Clarification: we will use scientific notation, where the symbol "^" means power. Example: "10^10", read as "10 to the 10". For reference, 10^9 are one thousand million; 10^10 are 10 thousand million; 10^11 are 100 thousand million; 10^12 is one billion.

I-THE NUMBER OF STARS
a-IN THE MILKY WAY
The number of stars can be calculated if first the mass of a galaxy is known. The position of the Solar System within the galaxy makes determining the properties of the Milky Way difficult. But with ingenuity, professionals have been able to overcome the obstacles. Thus, Licquia and Newman (2013) calculated a mass of 10^10 solar masses. However, this is a lower limit, as it is known that most of the stars in the galaxy are red dwarfs (M stars), whose mass is less than G stars like the Sun. So, by dividing the mass of the galaxy by a lower average mass, the number of stars must be greater. That is why many sources indicate a range of 10^11 and 10^12 stars in the Milky Way.
b-IN THE UNIVERSE
If a value for the total number of galaxies in the observable universe is obtained, then the number of stars in the Milky Way can be multiplied by the predicted number of galaxies, knowing that our galaxy is not exactly an average. Therefore, to know this, we must first investigate what astronomers have calculated for the number of galaxies.
II-THE NUMBER OF GALAXIES
With the Hubble Space Telescope, astronomers had the brilliant idea of taking very deep images, with long exposures over several days. Thus, the image we see below, covering less than a tenth of the angular size of the full Moon, obtained after two million seconds of exposure and combining images from the Hubble Ultra Deep Field (2002-2003) and the Ultra Deep Field Infrared (2009). This is the eXtreme Deep Field, Hubble eXtreme Deep Field (XDF).
The angular size of the image is 1/30 millionth of the sky and contains about 5500 galaxies.
By the Cosmological Principle, which implies that the Universe is homogeneous and isotropic, the number of galaxies in this small patch of sky can be extrapolated and multiplied by the entire sky. Thus, the calculation indicates that there would be about 170 billion galaxies (1.7 * 10^11).

With computational simulations, like Illustris and others, it has been suggested that the number of galaxies could be 2 trillion.
Christopher J. Conselice and others (2016) reached a similar result. In Figure 8 of their paper, a graph can be seen showing the integrated number of galaxies as a function of magnitude (solid black line) and the flux density of galaxies in energy units (blue dashed line). The two horizontal dotted lines show the total number of galaxies that could potentially be observed with present technology (green line) and the number predicted up to z<8 (red line). The z value is the redshift, used as an indication of distance.

Ib: NUMBER OF STARS IN THE UNIVERSE
If the number of stars in the galaxy is 10^11 and the number of galaxies is 10^12, and we multiply one thing by the other, by the Law of exponents, with equal bases, we can add the exponents: 10^23 stars. However, there are many more dwarf galaxies than the size of the Milky Way. On the other hand, the most massive stars observed, whose equilibrium period is short, should no longer exist. But since giant stars are a small percentage, as most are less massive stars, by adjusting these parameters the total number of stars should be in the range of 10^21 and 10^22.
Ten thousand quintillion stars!
III. NUMBER OF PLANETS IN THE UNIVERSE
The first problem with the number of planets is that the exoplanet catalog, which contains about 5000, is very small and biased. Most of the planets detected are hot Jupiters, not because they are the majority, but because they are easier to discover by the methods used.
However, the Kepler-32 system has a red dwarf star as its center. A study suggests it could be taken as a model for other stars of the same type, which are the majority. The Kepler-32 system has 5 planets. Jonathan J. Swift (not the author of Gulliver's Travels, but he has the same name), based on this data, calculated that there must be 1 planet per star, on average, in the Milky Way.

If we extrapolate to the universe, multiplying by the number of stars, as we did before, we would arrive at a similar result. With the increase in data, in the future, these estimates will be able to be more reliable.
In any case, there is no doubt that the potential number of stars, planets and galaxies is...astronomical. Does that seem like a lot? It has been calculated that the number of grains of sand on the world's beaches is 56,000 quintillion. Depending on how the calculations are done, there will be more or fewer grains of sand than stars. In the end, the Universe will be a gigantic emptiness carpeted with quichicientos million specks of dust.☉
Sources and related links
- How Many Stars in the Milky Way?
https://asd.gsfc.nasa.gov/blueshift/index.php/2015/07/22/how-many-stars-in-the-milky-way/ - Improved Constraints on the Total Stellar Mass, Color, and Luminosity of the Milky Way
Licquia y Newman (2013)
https://ui.adsabs.harvard.edu/abs/2013AAS...22125411L/abstract - There are more galaxies in the Universe than even Carl Sagan ever imagined
https://bigthink.com/starts-with-a-bang/galaxies-in-universe/ - How many galaxies are in the Universe?
https://bigthink.com/starts-with-a-bang/how-many-galaxies/ - How many stars are there in space?
https://theconversation.com/how-many-stars-are-there-in-space-165370 - Properties of galaxies reproduced by a hydrodynamic simulation
Mark Vogelsberger et al (2014)
https://arxiv.org/abs/1405.1418 - The Evolution of Galaxy Number Density at z < 8 and its Implications
Christopher J. Conselice, Aaron Wilkinson, Kenneth Duncan, Alice Mortlock
https://arxiv.org/abs/1607.03909v2 - Observable universe
https://en.wikipedia.org/wiki/Observable_universe
Searching the Entirety of Kepler Data. II. Occurrence Rate Estimates for FGK Stars
Michelle Kunimoto and Jaymie M. Matthews 2020 AJ 159 248
DOI 10.3847/1538-3881/ab88b0
There Could Be Up to 6 Billion Earth-Like Planets Out There in The Milky Way https://www.sciencealert.com/there-could-be-up-to-6-billion-planets-like-earth-in-the-milky-way
100 Billion Alien Planets Fill Our Milky Way Galaxy: Study https://www.space.com/19103-milky-way-100-billion-planets.html
Characterizing the Cool KOIs IV: Kepler-32 as a prototype for the formation of compact planetary systems throughout the Galaxy
Jonathan J. Swift et al https://arxiv.org/abs/1301.0023
Planets Abound https://www.caltech.edu/about/news/planets-abound-37829
Milky Way https://en.wikipedia.org/wiki/Milky_Way#Contents
Grains of sand and stars https://elpais.com/especiales/stories/ciencia-en-la-playa/arena-o-estrellas/
About the images
HUBBLE EXTREME DEEP FIELD (XDF)
https://hubblesite.org/contents/media/images/2012/37/3098-Image.html
NASA, ESA, G. Illingworth, D. Magee, and P. Oesch (University of California, Santa Cruz), R. Bouwens (Leiden University), and the HUDF09 Team
The Hubble eXtreme Deep Field https://esahubble.org/images/heic1214a/


