Do you have to go to court when you get evicted?
Only if you want to stay! If you agree to leave, there is no
dispute for a court to bother with.
It is best to go to court to defend yourself and to plead your
case, but if you just want to bail, you can do that too and the
judge will adjudicate against you and your lease (if it's still
intact) will be negated.