You need P(affecting outcome) x (value of positive outcome) > cost of voting.
Even assuming the value of a positive outcome is vastly bigger than the size of the world economy (e.g. $10^15, maybe $10^20), P(affecting outcome) is so fantastically low in any state with political leanings that you might as well not bother.
Littering in a public park is a separate issue - the effect of littering is cumulative, whereas the effect of voting is based on a threshold. Your litter makes the park incrementally worse. Donating blood does make a significant measurable difference - one particular person gets your unit of blood, and this helps them avoid death.
A dollar value can be assigned to all the things we've mentioned. Donating blood is worth multiple dollars, littering in a park is probably harmful to the tune of a few pennies. The dollar value of your vote is so small that double precision floats treat it as 0.
Mostly, there are two things to do before voting: 1) decide your position on multiple issues 2) think about how much the implementation of the system allows your positions to be communicated/counted (so some positions become more important because the system will allow them to have an effect)
both of these actions can be beneficial (and much so). 1 means thinking about life in society 2 means thinking about effective ways of agregating knowledge and preferences in a society
you could think of the elections as a holiday celebrating the fact that we live in a society, and inviting to think about it
One votes for the same reasons one refrains from littering in a public park, or gives a few dollars to a charity, or donates blood, or contributes to a Kickstarter campaign, or volunteers to go to war, or pays taxes. Not mainly because of the chance that your individual contribution will make a difference in and of itself, but to do your part in making society better for everyone. From the perspective of the whole social organism, if you refuse to do these things because your individual contributions don't make a direct difference, you're one of the harmful cells.