What is the chance your vote is the deciding vote in an election?

This is an interesting classroom topic, because there are a variety of more or less sensible ways to analyze the question. To start one needs to be fussy about what "deciding vote" means; the question suggests the possibility
the candidate you vote for wins by exactly one vote
which implies, from an egocentric viewpoint (Logically, your vote was really no more decisive that anyone else's, and the concept of "deciding vote" makes no sense; I am however sticking with the usual illogical interpretation of the question), that you cast the deciding vote. Another possibility is
the candidate you vote for ties with another candidate for first place
which would force a run-off or coin toss. It turns out these possibilities have essentially equal chance; I will treat each as an instance of ``deciding vote", but if you only want to consider the former then just halve the probabilities quoted below. I am assuming the simplest "candidate A vs candidate B" format, but having more than two candidates makes little difference.

There are two settings where we can state rough answers. The simplest setting is

In a political election that opinion polls suggest will be very close, the chance your vote is decisive is about 13/N, where N is the number of votes.

The actual number "13" here (and the "3" below) depends on some rather arbitrary assumptions below, and if you asked three different statisticians you would likely get three different numbers in place of "13" -- it's just a rough estimate.

Of course the estimate above is only relevant where there are opinion polls, typically for political elections with a large number N of voters. In a different setting, which I'll call a club election, there are say 50 -- 5000 voters. Here you would have only haphazard knowledge -- maybe you and 6 out of your 9 friends favor candidate A ( From which you can't make any statistical inference, because your friends are likely to have opinions similar to yours) -- but what's more relevant is whether or not there's a general sense that one candidate is a clear favorite.

In a club election where there seems to be no clear favorite, the chance your vote is decisive is about 3/N, where N is the number of votes.

The mathematics for these estimates is indicated below. An interesting article What is the probability your vote will make a difference? by Gelman et al gave a very detailed analysis, based on opinion polls as of 2 weeks before the 2008 U.S. Presidential Election, of the chance of a voter in each State having the deciding vote, taking into account the complexities of the Electoral College system. Their conclusion was that in each of 4 particular States, the chance was about 1 in 10 million. This paper also discusses the academic literature.

The math

In the first example the randomness coms from inaccuracy of the opinion poll; if sample proportion is close to 50% then density function (Bayes posterior, to be precise) of population proportion is about 0.4/sigma, and the chance your vote is decisive is 1/N times 0.4/sigma. Here the 0.4 is the Normal density at 0 and sigma is s.d. of opinion poll error. Taking sigma = 3% gives the stated formula.

In the second example all we know is "no clear favorite". Interpreting that crudely as "a prior distribution for proportion favoring candidate A is uniform on [a,b]" gives a probability your vote is decisive as 1/N \times 1(b-a). Taking [a,b] = [1/3,2/3] gives the stated formula.

Comment. It is a complete blunder to analyze elections as if people voted at random.