How do state determine school enrollment?

Specifically, how do states verify that children between say 6 and 18 are completing some satisfactory version of compulsory education? Obviously, they have enrollment lists for public and charter schools and probably for private schools. But how are these verified against how many children are out there? What, if anything, do parents have to do to “officially” homeschool their kids?

We chose a public school, so I’m curious as to how parents in less traditional choices handle the legalities.