Photons have an amount of energy that is directly proportional to their frequency. The higher the frequency, the higher the energy.
Photons from the sun are constantly striking the surface of the earth. These photons are predictable, in that we know that the rate at which they strike the earth is fairly consistent and the energy each one contains is pretty consistent as well
Photons are the mediators of the electromagnetic force
When photons strike an electron, they add energy to that electron. That electron will gain velocity. If it gains enough velocity, it will jump to a higher orbit.
Electrons don't like to remain excited. They'll try to lose that energy in order to settle into their most relaxed state.
The movement of electrons is what we call electricity.
Some materials actually produce electricity when struck with photons of specific energies. This is known as the Photoelectric Effect. Our main man, Einstein, published a paper on it in 1905.
By designing materials that react more readily to the photons that are emitted by the sun, we can convert more of the energy of those photons into electricity.
If we put these materials into cells and then put those cells into panels, we can cover a large area and convert more sunlight into electricity.
We can store that electricity in batteries and/or run it through an inverter which will convert it from the DC current it is to the AC current that our household appliances use.
That's all there really is to it, at a basic level. The idea right now is to create materials that are able to convert more and more of the sun's light into electricity while also being relatively safe to manufacture (after all, it's not really an eco-friendly solution if the end product does more damage to the environment than what we currently have). The sun pours about 1.3 - 1.4 kWh per square meter when it's directly overhead, on a day when the clouds are scarce. Currently, commercially available solar panels are able to extract about 150 to 170 watt-hours per square meter, and the hope is to get that up to about 520 to 560 watt-hours per square meter sometime in the next 20 to 30 years.