Summary:

If you lose your last city - to another civilization or to an angry city-state - then you lose immediately. This is very embarrassing, so don't let it happen to you.