when you vote you should get a cryptographically produced ticket that records your votes. when you vote your ballot has it's selections are read and assigned a placement in the official count. so you might have box 1756 that's your selection for president and then have 8423 that's your vote for senator and so on.  once the election is over your ticket can be scanned and it will tell you what slot your votes were put in so you can check against the official count to make sure your vote was correctly counted. this doesn't stop fake ballots by people that never voted, but it at least ensures your vote is proper.
Canada