If the lender purchases the property at the foreclosure sale/trustee sale, the lender will typically hire an asset manager to assist with the sale of the property.
The lender will then verify if the property is vacant. If you are still living in the property, the asset manager and/or agent that has been assigned will make arrangements with you for occupancy. It is important that you follow the lender instructions and/or requests as they can begin the evicition process.
If you have tenants, there MAY be some laws that protect thier occupancy. As always, legal council is always recommended.