In SF, when a lease "expires" it converts to an indefinite lease with a 30-day notice from the tenant to terminate. The lessor may only terminate for just-cause with varying notice periods and possible compensation to the lessee for damages caused.
Landlords push people out of housing in SF every day. It's often under shameful circumstances. And its not just Ellis Act, though that's a big part of it.
One of the drawbacks of renting is that you aren't guaranteed housing when your lease expires.