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.
Info: An individual 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 individual intends to return to.
Important: There is a difference between your State and Federal residency. You can be a resident for X State while still being a nonresident for tax purposes on a Federal level.