Solar panels are relatively simple.
Solar panels are made out of 2 silicon panels (not to be confused with silicone) and a panel colored black.
The 2 silicon panels are "doped" with a certain atoms. One of the silicon panels are laced with Phosphor-atoms and the other with Boron-atoms. The one with Phosphor is then has more electrons than normal which makes the panel negatively charged because it has free negative charges. The Boron makes is so that the other panel has less electrons than normal which will make it positively charged because there are "holes" between the silicon atoms. These panels are called N-type silicon and P-type silicon (negative and positive silicon plates). The N-panel is then placed on top of the P-panel and the black panel is placed on top of the N-panel (the black panel is only there to increase the effect, since black attracts solar energy). When the N-panel touches the P-panel, the N-panel is then "hyped" and the free electrons tries to go over to the P-panel to fill the missing holes between the silicon atoms. The two panels then switch charges. The P-panel becomes negatively charged and the N-panel becomes positive (since the P-panel gains electrons and the N-panel looses electrons). When these two panels get "hyped" when they touch, they create a barrier which makes electrons unable to pass between the N-panel to the P-panel after they switch charges. Now you might ask, where does the solar energy comes into the picture? When the sun rays hit the black panel and the electrons are kicked away from the P-panel to the N-panel, which then again switches the charges, but after this second change, they can't go anywhere. This is why we have wires connected to the two panels, this way the electrons will be able to return to the P-panel. In the "outer"-circuit the electrons will deliver energy to which ever device the wires are connected. The sun energy have now become electric energy.
From the device, the electrons will go to the P-panel which will make it negative again, this way the process is restarted and will be able to go around and around almost indefinitely.
If you bothered to read that wall of text, then you know how solar panels work.