Project Sunroof uses information in Google Maps to figure out how much sun falls on a roof. It takes into account stuff like the angle of the roof, the weather, and obstructions like trees and chimneys.
It then calculates how much sun falls on each roof and how much solar power that could generate, taking into account any local subsidy or promotion plans.
So far it only works in Boston, the San Francisco Bay Area and Fresno but is expanding to other areas all the time.