Grid intertied photovoltaic array (solar panel) systems work by what is called net metering.
The power company replaces the existing meter with one that measures not only power used, but power generated and put back on the grid as well.
The customer typically sells power to the grid when he or she is not home during the day, and buys power from the grid upon returning home in the evening.
Systems are often sized so the home or business owner is slightly ahead each sunny day, creating a bank of power to buy against on cloudy days.
The power company will write a check (at average wholesale rates) to the home or business owner for any remaining excess power generated at the end of the year.