How Do Solar Panels Work?
the Beginning - Solar Panel Structure
Basically, at the heart of this answer is a chemical reaction. The process starts with the previously mentioned sunlight, as it arrives to us in the official form of electromagnetic radiation (aka "photons"). At this point, the sun has pretty much done its part.
The solar cells are made of two layers of treated silicon with different atomic structures. So as sunlight hits a panel, the cells within absorb the sun's photons, through the top silicon layer. This causes very rapid electron movement (better described as "vibrations"), which in turn "frees" the electrons from the atoms. Since like charges repel and unlike charges attract, the electrons will seek out and move toward the bottom positive layer of protons located within the solar cell. Once all this activity is connected to an external load, the electrons will flow along a circuit in one direction, thus creating DC electricity (direct current).
Rounding out the picture, each cell in a panel is then wired together and interconnected in "series", thereby increasing the overall voltage potential of the panel. Modern panels are most commonly made up of 60 or 72 cells per module, arranged in rectangular form under tempered glass, and can now generate well over 400 watts per panel. Translated into kilowatt-hours, which is how one is billed by utilities for the amount of electrical usage, 400 watts provides up to 2 kilowatt-hours a day, or 730 kilowatt hours per year in sunny climates.
The result then, of a collection of solar panels, or "array", is the generation of DC current. The DC current however needs to be converted to AC (alternative current) in order to be used in the home to power appliances and turn on the lights. And there we find our partner in the process, the inverter.
Even on cloudy days, the panels will generate electricity, but will produce the most on sunny, cool days. Panels will produce even more energy when they have optimum orientation (south facing, for those in the northern hemisphere, and opposite for those in the southern hemisphere), and mounting angle (or "tilt"), as further described in this previous RE-volv article.
Panels will produce the most when the sun's rays are perpendicular to the panels, a time which is referred to as "peak sun hours". Shading, from trees, debris on the panels or clouds, can cause a loss of production, although there are technologies and electronics such as power optimizers and microinverters that fit on the undersides of each panel to help minimize those losses.
Long Do Solar Panels Last?
There are no moving parts to solar panels, and very little to go wrong in a well-made panel. Most manufacturers have warranties on the panels for 25-30 years, and they will last much longer. In fact, the first solar cell was invented by Bell Labs in the mid 1950's, and now over 60 years later it still works! Essentially, the cells themselves should never completely wear out.
Not to say panels don't show a little age over time. Panels age ever so slowly by losing a slight amount of production over the years. This is usually due to the internal wiring of the cell corroding over time, causing some output loss.
Even so, the top-tier panel manufacturers warrant at least 90% of a panel's original level of production after those 25 years, so the production decline is very slow and quite minimal overall. Solar panels rarely just completely stop working. If a panel stops providing electricity, it's usually due to something external to the panel, such as a corroded wire or broken connection point to another panel. However, the chemical reaction within the solar panels lives on.
The technology of solar power for house therefore is well-proven, safe, and very reliable. In general, over the years panels have gotten and will continue to get more efficient (incrementally producing more energy), but otherwise should not see any sort of major technology change that would render current models obsolete. Are solar panels durable? The standard test solar panels must first pass is the "hail test", whereby a 3" ice ball is projected on the panel at 50 mph at 90 degrees.
Maintenance is Need?
Solar panels are about as maintenance free as something could get, especially something outdoors over a 25+ year period. The only ongoing recommendation is to keep the panel faces clean, and for that in many areas regular rainfall will do the trick.