The key here is, of course, that you need a rigorous definition of continuity. You can look up the rigorous definition yourself, but it’d probably make a non-mathematician fall asleep. So I’ll re-cast it, as a game.
We have a function, y = f(x). And in any interval of x values of that function, there’s going to be some range of y values. We can specify those ranges as x ± Δx (that is, all of the x values within Δx of x), and y ± Δy (that is, all of the y values lie within at most Δy from y).
So, the game goes like this: You specify some maximum acceptable Δy (greater than zero), as a challenge. And then I have to meet that challenge, by specifying some Δx, such that I can always meet that challenge. If I can’t meet the challenge, then you win: You’ve proven that the function is discontinuous. If I can meet the challenge, then you’re allowed to issue another, more difficult challenge, with a smaller Δy. If, no matter what (greater than 0) Δy you pick, I’m always able to answer your challenge, then I win, and I’ve proven the function continuous.
Let’s see some simple examples. Suppose that our function is a nice simple y=x. Well, that’s an easy one for me: When you pick a Δy, I answer your challenge with the same number as my Δx. Since I can always answer your challenge, I win, and f(x) = x is continuous.
Another obvious one, the Heaviside function y = {0 if x <0, 1 if x ≥ 0 }. If our x value is 0, then you can win easily by picking any Δy less than 1 (say, 1/2): No matter how small I make my Δx, I’m going to include some negative numbers, for which f(x) = 1, so the Δy will always be 1. Since I can’t meet your challenge, you win, and prove that Heaviside is discontinuous.
OK, so now let’s look back to Thomae’s function. If we’re looking at it at some rational value of x, that is, x = p/q, then f(x) = 1/q. So all you have to do for your challenge is to pick some number smaller than 1/q. No matter how small I make my Δx, there will always be some irrational numbers in my interval (for which the function is zero), so my Δy will always be 1/q, which is larger than your challenge. I can’t meet your challenge, so you win, and so Thomae’s function is discontinuous at every irrational.
But now suppose that we’re playing at some irrational value. You set your challenge at some number, let’s call it epsilon. It’s a small number, but it’s not zero, and so 1/epsilon is finite. There are a finite number of positive integers q smaller than 1/epsilon, and so a finite number of fractions p/q (with q smaller than 1/epsilon) near our x. Since there are a finite number of such fractions, one of them must be the closest one to our x: It might be very close indeed, but it can’t be right on top of x, because we picked an x that was irrational. So I can certainly find some Δx small enough to exclude that fraction (and hence, all of the more distant ones as well). So all of the numbers within Δx of x will be less than epsilon, and so I can meet your challenge. And since I can always meet your challenge, I win, and I prove that Thomae’s function is continuous at every irrational value of x.