It varies by state and is something to look into. I mentioned Utah upthread----one the schools DD had narrowed it down to was in Utah, where they ENCOURAGE students (yes, students, under age 24) to get residency. In that case, the main things they had to do were stay in the state year round (no more than 30 nights outside Utah in a calendar year) and not be listed a dependent for tax purposes on their parent'y income tax. I think they also needed to get a Utah DL (or ID if they do not drive) and bank account registered to a Utah address (Which could be the dorm). MANY kids qualified for a "first year out of state tuition waiver" and then if they fulfilled the residency requirements after that could continue to pay in state.
On the flip side, Colorado is one of those states that makes it very hard to qualify for in state tuition. DH and I grew up in Colorado. We both graduated high school and college there. Our only legal address in the US is in Colorado--where we get mail and DH still has his driver'S license but we really live here in Germany and just visit Colorado once in a while. DD spends every summer in Colorado. Her US ID is from Colorado. She will attend school there and be staying there in the summers and working--she no longer even has a residency permit to live in Germany and could not legally spend all of summer break living with us if she wanted to. She truly and legally has NO other legal address than that in Colorado, but she is not considered in state because we, her parents, do not live there.
Different states. Different systems and different priorities.