The Mathematics of Elections and Voting