[proofplan]
We complete the square after multiplying the quadratic congruence by $4a$, which is invertible modulo $p$ because $p$ is odd and $p \nmid a$. This transforms the original congruence into the square-root congruence $(2ax+b)^2 \equiv \Delta \pmod p$. The affine map $\bar{x} \mapsto \overline{2ax+b}$ is a bijection of $\mathbb{Z}/p\mathbb{Z}$, so the two congruences have the same number of solutions. The required count then follows from the Legendre-symbol count of square roots modulo an odd prime.
[/proofplan]
[step:Complete the square after multiplying by an invertible factor]
Let $R := \mathbb{Z}/p\mathbb{Z}$, and for each integer $n \in \mathbb{Z}$ let $\bar{n} \in R$ denote its residue class modulo $p$. Since $p$ is odd, $p \nmid 2$, and since $p \nmid a$ by hypothesis, we have $p \nmid 4a$. Thus multiplication by $\overline{4a}$ is invertible in $R$.
For any $x \in \mathbb{Z}$, the identity in $\mathbb{Z}$ is
\begin{align*}
4a(ax^2+bx+c)=(2ax+b)^2-(b^2-4ac).
\end{align*}
Since $\Delta := b^2-4ac$, reducing this identity modulo $p$ gives
\begin{align*}
\overline{4a}\,\overline{ax^2+bx+c}=\overline{(2ax+b)^2-\Delta}.
\end{align*}
Because $\overline{4a}$ is invertible in $R$, the congruence
\begin{align*}
ax^2+bx+c \equiv 0 \pmod p
\end{align*}
is equivalent to
\begin{align*}
(2ax+b)^2 \equiv \Delta \pmod p.
\end{align*}
[/step]
[step:Show that the affine change of variable is a bijection]
Define the map
\begin{align*}
\Phi: R &\to R
\end{align*}
by
\begin{align*}
\Phi(\bar{x})=\overline{2ax+b}.
\end{align*}
This is well-defined because congruent integer representatives give congruent values under the integer expression $2ax+b$.
We prove that $\Phi$ is injective. Suppose $\bar{x}_1,\bar{x}_2 \in R$ satisfy $\Phi(\bar{x}_1)=\Phi(\bar{x}_2)$. Then
\begin{align*}
\overline{2ax_1+b}=\overline{2ax_2+b}.
\end{align*}
Equivalently,
\begin{align*}
2a(x_1-x_2)\equiv 0 \pmod p.
\end{align*}
Since $p \nmid 2a$, Euclid's lemma gives $p \mid (x_1-x_2)$, so $\bar{x}_1=\bar{x}_2$. Therefore $\Phi$ is injective. The finite set $R$ has exactly $p$ elements, so every injective map $R \to R$ is surjective. Hence $\Phi$ is a bijection.
[guided]
The point of introducing $\Phi$ is to make precise that the substitution $y=2ax+b$ does not change the number of residue classes being counted. Define
\begin{align*}
\Phi: R &\to R
\end{align*}
by
\begin{align*}
\Phi(\bar{x})=\overline{2ax+b}.
\end{align*}
This formula is well-defined: if $\bar{x}=\bar{x}'$, then $x \equiv x' \pmod p$, so $2ax+b \equiv 2ax'+b \pmod p$.
Now we verify that $\Phi$ is a bijection. It is enough to prove injectivity, because $R=\mathbb{Z}/p\mathbb{Z}$ is finite with $p$ elements. Suppose $\Phi(\bar{x}_1)=\Phi(\bar{x}_2)$. Then
\begin{align*}
\overline{2ax_1+b}=\overline{2ax_2+b}.
\end{align*}
Subtracting the two residue classes gives
\begin{align*}
\overline{2a(x_1-x_2)}=\bar{0}.
\end{align*}
Equivalently,
\begin{align*}
p \mid 2a(x_1-x_2).
\end{align*}
The hypotheses are used exactly here: $p$ is odd, so $p \nmid 2$, and $p \nmid a$ by assumption. Hence $p \nmid 2a$. Since $p$ is prime, Euclid's lemma implies $p \mid (x_1-x_2)$, which means $\bar{x}_1=\bar{x}_2$. Thus $\Phi$ is injective, and therefore bijective.
This bijectivity is what justifies replacing the variable $\bar{x}$ by the new variable $\bar{y}=\overline{2ax+b}$ without losing or duplicating any solutions.
[/guided]
[/step]
[step:Reduce the solution count to a square-root count]
Let
\begin{align*}
S := \{\bar{x} \in R : ax^2+bx+c \equiv 0 \pmod p\}
\end{align*}
and
\begin{align*}
T := \{\bar{y} \in R : y^2 \equiv \Delta \pmod p\}.
\end{align*}
The equivalence proved above shows that for every $\bar{x} \in R$,
\begin{align*}
\bar{x} \in S \iff \Phi(\bar{x}) \in T.
\end{align*}
Since $\Phi: R \to R$ is a bijection, its restriction gives a bijection from $S$ onto $T$. Therefore
\begin{align*}
|S|=|T|.
\end{align*}
[/step]
[step:Apply the Legendre-symbol square-root count]
By [citetheorem:10088] applied to the integer $\Delta$, the number of residue classes $\bar{y} \in \mathbb{Z}/p\mathbb{Z}$ satisfying
\begin{align*}
y^2 \equiv \Delta \pmod p
\end{align*}
is
\begin{align*}
1+\left(\frac{\Delta}{p}\right).
\end{align*}
That theorem includes the case $\Delta \equiv 0 \pmod p$, where the [Legendre symbol](/page/Legendre%20Symbol) is $0$ and there is exactly one solution, namely $\bar{y}=\bar{0}$. Since $|S|=|T|$, the number of residue classes $\bar{x} \in \mathbb{Z}/p\mathbb{Z}$ satisfying
\begin{align*}
ax^2+bx+c \equiv 0 \pmod p
\end{align*}
is
\begin{align*}
1+\left(\frac{\Delta}{p}\right).
\end{align*}
This is the desired formula.
[/step]