Solar panels mounted on the roof harness the power of the sun to create DC electricity.
This electricity flows to an inverter, typically mounted on a wall in the vicinity of the electrical panel, where it is converted to usable AC electricity.
From there power flows through a solar meter and into your electrical panel where you’re able to use what you need to power your home.
If there’s any excess electricity generated, it’s returned to the the grid via the utility meter in exchange for a credit from the utility to use when the sun is not shining and you need to draw electricity from the grid.