In conditions where demand for housing increases dramatically, landlords tend to let apartments go vacant because they do not want to lock in a low price immediately if they know they could be stuck with a tenant for a long period of time. You can see this effect when you compare the cost increases of apartments over time with the allowable increase set by the rent control board.
You can model renting your building quickly in excel. When you do so you can find the cases when it is smarter to hold the apartment and let market prices increase instead of leasing today. Your job as a landowner is to maximize the total amount of money you can make from ownership of the property. Landlords act rationally, so if you make rules that incentivize them to not rent it shouldn't be surprising to see empty units. If you run the numbers yourself for what happened in San Francisco you will easily be able to duplicate this effect.
It's ok if you need to leave your apartment so long as you can find another apartment nearby. No one has a right to live in a particular city, and scarce resources will go to those most willing to pay for them.
https://www.rentjungle.com/average-rent-in-san-francisco-ren...
https://sfrb.org/sites/default/files/Document/Form/571%20All...