Question: Lets say you work in Chicago and live in Chicago but put your home address as somewhere in Indiana. Then every week you collect the mail that is being sent to you in Indiana. Wouldn't you save a lot of money assuming the taxes are lower? What prevents people from doing this?

Answer: 
Lying to save on taxes is called tax fraud. The threat of large fines and jail-time is what prevents most people from committing tax fraud.
Some adjoining states have reciprocity agreements. In those cases it is where you live that determines which state taxes apply.

But if you aren't covered by one of those agreements. Then each state will try and determine if they can claim you. 

The states set out in their laws what you need to do to claim residency. They look for things like which address do you have bills sent to, where are you registered to vote, where do you have your drivers license. There ra e also exemptions carved out for active duty military, college students, and workers who are on temporary assignments.

The risk is being charged with tax fraud. You could be hit with interest and penalties. In your example Illinois would claim taxes going back for more years than Indiana will be willing to refund. They could also hit you with other fines for not registering the vehicle, or getting a drivers license, or paying a personal property tax.

Ways you could get caught. Parking a car with an out of state license plate for too many nights. When you get to a point when you need to apply for a benefit from the other state.

I knew somebody who moved states, but didn't tell their company for years. Then their child wanted to go to a school in their new state. They weren't allowed to register for school until they resolved all the issues. It cost them a ton of money.