It's a really tough one. The whole legal system built around "citizen of a state" and "reside in a state" was designed 250 years ago, when people were mostly stationary. Few ever travelled, and few migrated. And if they migrated, they tended to do it once.
What we have today is a very different world. We have people doing jobs remotely. Cherry picking which state they "reside" in for tax purposes. Optimizing for a crazy large amount of paperwork. I used to have a colleague who had to live near the Canada/US border, because their spouse could only work in Canada (issues with medical licensing and doctoral degrees), while they had to get paid by a US company and be a US citizen (working indirectly for big brother). They moved back and forth several times over 15 years to get the kinks worked out; it got harder when their kids started school. Fortunately, between WA and BC, the distances aren't crazy. We also have people who live in RVs and have de-facto no permanent home. And people who travel for months at a time for jobs. Or people who retire to another state (because grandkids, cost of living, weather, what have you). I think the worst example are professional musicians: If you play for say the NY Philharmonic, and you play in 27 states on the great concert tour, you'll end up doing 27 tax returns at the end of the year, because every state will treat the income earned here (by sawing a violin or blowing a clarinet) as in-state.
But then, we have the stupid 10th amendment (and I use the S word deliberately and intentionally). Which means every state has its own tax system and legal system. This is DUMB. And California is particularly obnoxious about treating everyone who has ever been here as a resident for various purposes. Example: If you've worked in Silicon Valley and got stock (options!), then some of the gains from that stock will forever be taxable in California, even long after you've moved elsewhere. I have several retired friends in WA (low taxes!) who still have to fill out a CA tax return every year, for small amounts. The worst example is a friend who used to work for the UC in California, and then moved to the Univ. of Wisconsin. A few years later, he was visiting Stanford, and (like most people) got a speeding ticket on 280. Except that the CHP insisted on arresting him, because CA had a warrant out for his arrest for unpaid taxes. Turns out that the CA tax authorities treated him as a resident for several years, after he was living in Madison WI, and were of the opinion that he owed a lot of taxes on his income from Wisconsin. He spent a night in jail, and the next day (with the help of his lawyer ex-wife, who was by then a judge in another state) he got released. Obviously he was right and the CA authorities were wrong ... but that doesn't help when you're in lockup.
So here's my answer. Instead of working out who is a resident of where, let's just treat everyone exactly the same. It simply doesn't matter where you physically are. This makes great sense from a non-discrimination viewpoint: we can't treat people from other places worse (or better), just because they aren't "one of us". This would immediately abolish the power of states to raise their own taxes. Which would be a great simplification; instead states would get a (fair) handout from the federal government; and if they don't agree what is "fair", they can use politics or courts to adjust it.
Similarly, it would make a lot of regulatory and criminal law much easier. California could still do things like prohibit foie gras or large capacity magazines, but those prohibitions would apply to anyone who is inside California right now, and to nobody else. Similarly, school attendance would become trivial: If Monday morning little Alice is standing in front of a prestigious public school in Santa Monica or Palo Alto, and she (or her mom) says "I want to go to Kindergarten here", then so be it. Whether she sleeps at night in Watsonville, Compton, or Flint MI makes no difference. Oh, and the mom (if a US citizen) gets to vote, in exactly one precinct. Wherever she finds it convenient ... probably the one nearest to home. But only in one, and she gets to pick.
Statists of all political stripes would hate that, because they'd lose power.