On one level, we can say that elections work by voters casting their ballots and their ballots then being counted and a winner declared. Voters in different states cast ballots in different ways. Some states vote only by mail. Some are trying electronic voting machines rather than paper ballots. In all cases, the ballots are counted and a result is certified by officials in each jurisdiction.
On another level, we can say that elections work by giving the government some direction. Candidates make promises as to what they will work for if elected. If we vote for them, we are presumably supporting their policy positions. This helps tell the government what to do.