There are always a few illegals who vote, usually because they were confused, and rare that a dead person is voted. The numbers are quite small, if you believe the Secretaries of State.
And some ballots get miscounted, it's a human endeavor.
The larger problem I think for local elections if ballot harvesting, of the illegal kind.