Example 3 Find the number of ordered integer pairs $(a, b)$ such that $x^{2}+a x+b=167 y$ has integer solutions $(x, y)$, where $1 \leqslant$ $a, b \leqslant 2004$.

---

The translation maintains the original text's line breaks and format.
From Theorem 1, we know that when $p$ is an odd prime, $S^{2}$ modulo $p$ can take exactly $\frac{p-1}{2}+1=\frac{p+1}{2}$ values (note that $S$ can be 0).

Thus, when there exists $x \in \mathbf{Z}$ such that $x^{2} + ax + b \equiv 0 \pmod{167}$, then there is an integer solution $(x, y)$. Multiplying both sides of the equation by 4, completing the square, and rearranging, we get: (this is actually the step for solving a quadratic congruence equation)
$$
a^{2} - 4b \equiv (2x + a)^{2} \pmod{167},
$$

Therefore, $a^{2} - 4b$ can take exactly $\frac{167-1}{2}+1=84$ values modulo 167 (including 0), which are $\left(a\right.$ taking $0, 1^{2}, 2^{2}, \cdots, 83^{2}\left)\right$.

Since $167 \times 12 = 2004$, each $a$ corresponds to $84 \times 12$ values of $b$ that satisfy the requirement, so there are a total of $2004 \times 12 \times 84 = 2020032$ different ordered integer pairs.