It actually does not know this. This is a very hard problem to solve in the US. There can be positive evidence of this (John Jones has been a resident of California since birth, has a birth certificate (state document) and a Social Security (federal) number reflecting that), but John Jones may have been born in PA with no Social Security number or birth certificate at all and be a current resident of California, having moved there last year, and a perfectly legitimate US citizen eligible to vote in California for local, state, and federal offices.
There is no national US citizen registry, mostly for historical reasons, and making one is a total political nonstarter. Further, states are individually responsible for determining if someone is probably an eligible voter, and so there’s different processes and checks in place depending on the state.