An actual good question. Many places have no fault evictions. This means the landlord asks you to leave, but you’ve not violated your lease in any way. In those places, which are some cities in the US, entire provinces/states in some countries, and entire countries elsewhere in the world, that would be an unlawful eviction.
There are other places that allow eviction for specific reasons even if you’ve done nothing wrong, otherwise similar to no fault. For example the usual reasons are if the property is being sold, or if the landlord is moving back in themselves. It would be unlawful for the landlord to evict you on the guise of moving in themselves, and then find it re-rented a couple months later.