In a few of my statistics classes, I was taught that the procedure for carrying out a hypothesis test for a statistic $X$ with observed value $x_0$ is to determine the distribution under the null hypothesis $H_0$, and to compute the probability $P(X \geq x_0)$ (or $P(X \leq x_0)$, etc, depending on the test) under the null hypothesis, and to reject the null hypothesis if this probability is too small.
However, I've always wondered why we compute $P(X \geq x_0)$ rather than $P(X = x_0)$, since as I understand it, what we're interested in is the probability that we observe that particular result $x_0$ by chance.
The only explanation I've heard so far is that it's not possible to compute $P(X = x_0)$ if $X$ follows a continuous distribution, but this doesn't explain the case where $X$ follows a discrete distribution, and it doesn't seem like a satisfactory explanation even in the continuous case.
So why do we compute $P(X \geq x_0)$ rather than $P(X = x_0)$?