By official count there are either 40 or 48 neighborhoods in San Francisco, depending on who you ask. Unofficially, there are many more, and there always have been.
"The pioneers always had big plans for San Francisco - but it turned out to be a city of neighborhoods built around a downtown core. There were four reasons for this: geography, changing housing patterns, transit lines and disasters like the 1906 earthquake and fire.
San Francisco was laid out in a grid pattern imposed on a city of hills built on the end of a peninsula. This meant the city had a small area, but the grid pattern of the streets and the hills meant portions of the city were divided from each other, in separate little valleys."