Basic structure:

First, sunlight hits a solar panel on the surface. The panels convert the energy to DC current, which flows to an Inverter. The Inverter converts the electricity from DC to AC, which you can then use to power your home. 

Solar panel:

Solar panels consist of solar cells(photovoltaic cell ), these are made of silicon or Germanium, like semiconductors. They are constructed with a positive layer and a negative layer, which together create an electric field, just like in a battery.

To work, photovoltaic cells need to establish an electric field. Much like a magnetic field, which occurs due to opposite poles, an electric field occurs when opposite charges are separated. To get this field, manufacturers "dope" silicon with other materials, giving each slice of the sandwich a positive or negative electrical charge.

Specifically, they seed phosphorous into the top layer of silicon, which adds extra electrons, with a negative charge, to that layer. Meanwhile, the bottom layer gets a dose of boron, which results in fewer electrons, or a positive charge. This all adds up to an electric field at the junction between the silicon layers. Then, when a photon of sunlight knocks an electron free, the electric field will push that electron out of the silicon junction.

A couple of other components of the cell turn these electrons into usable power. Metal conductive plates on the sides of the cell collect the electrons and transfer them to wires. At that point, the electrons can flow like any other source of electricity.

Read more: