San Francisco Examiner has reported on a study produced by the Asian Law Caucus focusing on the Excelsior district that reminds us how many "illegal" units there are in the city. (There are lots of euphemisms for these units including "in-law", "non-permitted" and "unwarranted" -- but the important factor is they are not approved by the city as legal dwelling units). According to the ALC, one out of every three homes in the Excelsior has such a unit.
Back in the mid '90s estimates were that there are as many as 30,000 illegal units city-wide.
As many as 5-6% of single family homes listed in the MLS (sold in 2012) describe some sort of "unwarranted" condition in the marketing or agent remarks.
There are lots of implications to this number of "shadow" living units (read the Examiner story and the Asian Law Caucus report). From a pure real estate perspective, the presence of an illegal unit is something to consider carefully, especially if there is an in-place tenant.