When you say occupied is it a renter or previous owner.
I am assuming the property is in California.
It makes a difference if the occupants are renters or previous owners as the eviction process is different. California law has provided special protection to tenants in post foreclosure evictions. In a 2012 Amendment, providing the tenant with a 90-day notice to quit if the tenant were a bona fide tenant (§ 1161b).
Moreover, if a tenant has an unexpired lease, a landlord/tenant relationship exists until the lease expires and, thus, no notice to quit can be sent until after expiration of the lease.Of course, if the tenant fails to pay the rent or is otherwise in breach of the existing lease, the successful purchaser has the right to pursue eviction under standard landlord/tenant grounds.
As to a holdover owner, you would have to file an unlawful detainer.
Through my experience there are two things that could happen.
The holdover owner leaves or stays and fights the UD.
If the previous owner decides to fight, the legal cost can become quite significant, especially if it goes to trial.
Investing in these types of properties can be tricky, another issue you must investigate is pending litigation on the property.
California is a non judicial state, which means the foreclosing entity can foreclose on the property without court involvement.
A title search can reveal a pending action against the property, but only if a lis pendens (pendency of Action) was filed in the county recorders office.
The problem is that a pro -se litigant(representing themselves) may not file a lis pendens, therefore not revealed through a title search as they rely on the public record.
Even if the court finds you are a bona- fide purchaser unless there was fraud involved, you can be drawn into the lawsuit as a doe defendant and again costly in legal fees defending your position.
I hope this helps avoiding pitfalls in buying foreclosures which are occupied in California.
*Disclaimer* This is for educational purposes only and not legal advice, you should seek competent legal representation.*