How does a solar electric system work?

Photovoltaic (PV) cells are typically made of silicon, the same material used to make computer chips.  A PV panel (sometimes called a solar panel, solar module or solar collector) is made up of many PV cells strung together.  PV panels convert light directly into electricity.  This electricity is in the form of DC, or direct current, like that of a car battery.  The electricity flows from the PV panels to an inverter, where the electricity is turned into AC (alternating current), which is what you need to run your appliances.  
Grid-tied systems are set up to deliver energy to the grid during the daytime and consume energy from the grid at night.  When a system is delivering more power than the customer is using, the meter spins backwards and the utility credits the customer for the amount of energy delivered.  With PG&E’s time-of-use (TOU) rate system, electricity prices are higher during the daytime and lower at night.  This is perfect for a  grid-tied solar system because it delivers energy to the grid during the day and receives more credit per Kwh than if that energy were delivered at night.  The customer then draws power from the grid at night when the system is not producing and electricity prices are low.  With grid-tied solar, you can eliminate your electricity bill without needing to install a system that produces 100% of your energy needs.
As the name implies, off-grid systems have no connection to the grid and operate independently.  Off-grid systems are most popular and practical for sites that don’t have power lines nearby.  The cost to build new power lines varies wildly, depending on location, from $15,000 to $80,000 per mile.  Off-grid systems offer a clear economic advantage in these cases.  An off-grid system includes a battery bank that stores energy produced by the system to be used when it is not producing.  When the system is generating power, energy is sent to a charge controller—a device that regulates the flow of energy from a wind turbine or solar panel to the battery bank.  The inverter taps off the DC power of the battery bank and converts it to AC power to be used in the building.   The battery bank typically consists of  deep cycle lead-acid batteries strung together to form one large battery.  When a system generates more power than the electrical loads are consuming, the battery bank charges up.  If the battery bank is fully charged and the system is still overproducing, the excess energy (energy produced above and beyond fully charged batteries and satisfied electrical demand) can be blocked by the charge controller or shed by a dump load—a large resistor that “dumps” the excess electricity by converting it into heat.  These systems can be either fully automated or user-assisted, depending on the customer’s budget and abilities.  It is possible to connect a generator that automatically starts up to keep the batteries charged when there are long periods of no sun, wind, or hydro.  Every off grid system should have a back up generator.