It depends. If a Mexican is caught here --- and they were not caught committing some other crime --- and they do not lie and claim they are American citizens or show false documentation --- then they have a very nice option called "voluntary departure" or "hop in --- we'll give you a ride back to Mexico" --- and they don't have any record at all --- not even a misdeamor and there are no restrictions on them coming here legally. They can do this many times as long as they aren't caught in any other crime and choose voluntary departure. The worst they have to do is lie and claim they aren't working yet.
If they are involved in some other crime or claim they're American and it's discovered they aren't then they have to go through a legal process. Deportation gets you banned from legal entry for 5 years or forever --- if you committed a felony crime.