Having lived in a few places I see rent control and legislation like Prop 13 as major contributors.
When people cite the average rent in SF, that's based on what's currently on the market. What is not counted is the (much greater) inventory that is currently occupied, with rent-controlled tenants paying far less than market rate.
When someone cites "the unaffordability" of rent in order to justify rent control, what you also don't see is the high cost of MOVING that comes with rent control. My SF neighbor had been in her unit since the 90's, paying less than half my rent, and she can't afford to move if she wanted to! If she were to move she'd have to leave the Bay Area. She's trapped. Rent control doesn't improve housing choice in that sense.