How much electricity would we need to generate if we covered the entire surface of the earth with solar panels and solar power reaches the Earth's surface?
A rough theoretical estimation of how much energy we can generate and how much we need for manufacturing and installation is done this way.
The surface area of the earth is 5x1014 m2. Note that the entire area is not equally illuminated at different times of day and on different days of the season. So, we consider the average irradiation received by the earth as 8 kWh/m2 per day for 365 days; the entire earth receives 40x1014 kWh of sunlight daily, but the energy is distributed in different time zones.
Considering that polycrystalline PV panels have an energy conversion efficiency of 15%, battery or inverter efficiency of 90%, and another loss of 5% in transmission and distribution, we get an overall efficiency of 12.8%. So, we can have 5.12 x 1014 kWh of electricity per day. This translates to 1868.8 x 1014 kWh per year.
Now, some energy will be needed to manufacture the PV panels. Typically, 120-200 kWh/m2 energy is needed to manufacture different PV panels. Therefore, to cover the entire earth, we will need 600x1014 - 1000x1014 kWh of energy for manufacturing all the PV panels. (I am not sure whether Earth has that many minerals to cover it with PV panels).
Apart from this, transport, installation, maintenance, and repair would also require a large amount of energy.
There is a parameter called energy payback time. It is the minimum time required to recover the energy used in manufacturing and installing the product by generating and / or saving more power during the operation. The energy payback is between 1-4 years.
Energy Payback period reference: https://www.nrel.gov/docs/fy04osti/35489.pdf
Solar power is more powerful than many people realize. It would only take 191,817 square miles of solar panels to power the entire Earth. The spectrum of solar light at the Earth's surface is mostly spread across the visible and near-infrared ranges with a small part in the near-ultraviolet. Most of the world's population live in areas with insolation levels of 150–300 watts/m2, or 3.5–7.0 kWh/m2 per day. The amount of sunlight that strikes the earth's surface in an hour and a half is enough to handle the entire world's energy consumption for a full year. Solar technologies convert sunlight into electrical energy either through photovoltaic (PV) panels or through mirrors that concentrate solar radiation. Space-based solar panels can generate 2,000 gigawatts of power constantly. This is 40 times more energy than a solar panel would generate on Earth annually. This is also several folds higher than the efficiency of solar panels today. Not all of the Sun's energy that enters Earth's atmosphere makes it to the surface. The atmosphere reflects some of the incoming solar energy back to space immediately and absorbs still more energy before it can reach the surface. The remaining energy strikes Earth and warms the surface. The average solar panel has a power output rating of 250 to 400 watts (W) and generates around 1.5 kilowatt-hours (kWh) of energy per day. The total surface area of all the rooftops in the entire world is around 0.2 million square kilometres and you wouldn't need to plaster them all with solar panels to meet the world's current electricity needs: in fact, only half of them would suffice. Technically, yes. There is sufficient Solar irradiance and PV panels are efficient enough to turn that insolation into enough energy to power the entire world. The solar panels are rated at 350W, the world would need roughly 51.428 billion solar panels. Additionally, if 4 acres can accommodate a 1MW plant, 74.16 million acres of land would be required to power the planet. Averaged over an entire year, approximately 342 watts of solar energy fall upon every square meter of Earth. This is a tremendous amount of energy—44 quadrillion (4.4 x 1016) watts of power to be exact.