Election supervisors look for this. Also, the ballots themselves are not "write your vote on paper", they are specifically printed and available at the polling station.

The way the vote works is:

1. Come in at the polling station you are alloted to, based on your address.

2. Show your ID, and have them verify you are indeed on the electoral lists for this polling station.

3. Receive the ballot papers. These are stamped by the election official before they are given to you. You receive one ballot paper for each election currently organized (e.g. one paper for choosing your mayor, one paper for choosing your president etc). You also receive an official stamp. You are responsible for checking that the ballot you received is valid (stamped in exactly one place by the election official, not torn or scuffed etc). You can ask any election official for help if you suspect something is wrong.

4. Go into a polling booth, and put the stamp on the box for the candidate you want. Fold the ballot so your choice is not immediately visible (producing evidence of who you voted for, such as taking a picture or showing your ballot to someone else is a crime, punishable with a fine or jail time).

5. Put the ballot in the ballot box. There may be a single ballot box for all ballots, or one ballot box per election.

That's it - normally takes ~5 minutes, unless there are lines, which can happen at certain hours in certain busy places. Still, the size of polling stations is set by law to be big enough for the electoral lists of the area they are close to.

Counting is then simple:

1. Once the election day is officially closed, the ballot boxes are opened. Officials from each participating party are present in each polling station, and they perform the following operations together.

2. All ballots are validated and sorted. Any ballot which is not valid (e.g. not the right paper, not stamped by the election official, stamped in multiple places by the voter, stamped outside the vote area, paper is torn etc) is discarded. The discarded ballots are still numbered and stored, in case of disputes.

3. All ballots are opened and counted. Results are tabulated, and signed by all election officials in the polling station. The counted and sorted ballots are stored in secured bags. Results are communicated electronically to regional and then national election commissions.

3.5 Ballot counts must exactly match voter counts for this station. If they don't, police are called and videos are reviewed to identify the cause. Stolen or stuffed ballots are crimes and carry heavy fines or prison.

4. Election officials start collecting the bags from each polling station and storing them with each regional election commission office. The polling station attendants are responsible for ensuring the ballots arrive safely at the destination regional election office.

5. The process repeats until everything is centralized at the national electoral comission.

Preliminary results are typically announced starting ~1 h after the polls close.

Final results are typically announced the day after, usually by the night time.

Disputes at any level are arbitrated by the electoral commissions, and can be raised all the way up to the courts.

Any citizen can register beforehand and volunteer to work as an electoral official in any polling place, and personally monitor the process. Journalists and NGOs regularly do this.

Each political party keeps a separate, unofficial running count of the results.

The whole things scales beautifully, and is very hard if not impossible to systematically defraud (unless political parties systematically collude against their own candidates, but if they are willing to do that, the results don't really matter anymore anyway).