This YouTube video from the Princeton study of Diebold voting machines by Ariel J. Feldman, J. Alex Halderman, and Edward W. Felten explains exactly how it is done.

And this video shows a more humorous demonstration.