When I was a philosophy grad student in the ancient times at the U. of Virginia, some over-smart logician pointed out to me that voting is not rational, since a single vote is never decisive. It’s all the other stuff that’s rational: appearing to have voted, applying a sticker to your bumper, registering voters, making phone calls — because all of that stuff has the potential to spread sufficiently to make a difference in the election, or perhaps in a future election or in other forms of civic engagement.
But, of course, unlike the model “persons” in philosophical or economic mental experiments, actual people tend not to be sociopaths. Pretending to vote without voting is far more work than actually voting, which — while it may be irrational — does no harm. And so, good citizens tend to vote even understanding its irrationality, and even when there are no candidates worth voting for.