There are several situations in which the court could determine that you re-entered the country illegally. It usually depends on the circumstances under which you left the country.
According to Cornell Law School, most reasons for illegal re-entry are for criminal convictions, but there are a few that are not dependent on a criminal history.
Commonly, illegal re-entry will occur if the court removed you from the U.S. because you have a conviction for an aggravated felony. Another scenario is court removal due to specific misdemeanor crimes, including violent crimes or those related to drugs. In that situation, you could face removal for three or more misdemeanors in those categories.
Once the court removes you from the country for these criminal reasons, you cannot re-enter the country. Trying to re-enter would lead to illegal re-entry issues.
The court may also determine that you are re-entering the country illegally if you had previously tried to come into the country or faced removal for some non-criminal reasons. These include being a danger to yourself or others due to a mental disorder or general behavioral issue. You may also have a ban on re-entry if you have a communicable disease or have an addiction to drugs.
The court also has some discretion when it comes to staying in the country or illegal re-entry. If the court finds something about you or your situation that would be a threat to the U.S. or to other people -in the country, then it could lead to illegal re-entry. It is important to understand any removal from the U.S. will usually have conditions on it for legal re-entry. You will typically receive notice of any conditions, including when it is illegal to re-enter the U.S.