Residency rules and establishing residency for state tax purposes vary from state to state. Most states will look at a list of residency "factors" that have been long established like domicile (permanent residency), or the day counting rule.
Owning a home, family location, and financial interests are other factors which help determine residency.
A person may be considered a resident of the state in which he or she currently lives, but still be considered domiciled in another state/country to which the person intends to return.