What counts as trespassing?
You can be charged with trespassing when you go onto to property that is marked with "No Trespassing" signs or if you stay on property after you've been asked to leave. The signs have to be posted clearly and it's not necessary for you to actually see the "No Trespassing" signs to be convicted.
The prosecution will also have to prove that the person who posted the signs or told you to leave the property had authority to do so.
What's the punishment for trespassing?
Trespassing is a Class 1 misdemeanor. That means if you are convicted you could face up to 12 months in jail and a $2,500 fine. It is hard to imagine a case where someone would be a maximum punishment for trespass. In fact, the most common punishment is a fine and a court order to not go onto the property again.
Even though you are probably not going to jail if you are convicted of trespass, it is important to consult with an attorney because there are ways to defend a trespassing charge. Also, because trespass is a Class 1 misdemeanor, it will stay on your criminal record forever if you are convicted. There is no way to have a trespassing charge removed from your record if you are convicted.