[guided]The goal of this step is to replace a congruence condition by a sum over characters. Define $G := (\mathbb{Z}/q\mathbb{Z})^\times$, the multiplicative group of reduced residue classes modulo $q$, and let $\widehat{G}$ be its group of complex-valued characters. A Dirichlet character modulo $q$ is a character on $G$, read as a function on integers coprime to $q$, and extended by $0$ on integers not coprime to $q$.
We prove that for every integer $n$, the character average equals the reduced residue class indicator. Explicitly, if $n \equiv a \pmod q$, then
\begin{align*}
\frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n)=1.
\end{align*}
If $n \not\equiv a \pmod q$, then
\begin{align*}
\frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n)=0.
\end{align*}
First suppose $\gcd(n,q)>1$. Then every Dirichlet character modulo $q$ satisfies $\chi(n)=0$, so the character average is $0$. Also $n \not\equiv a \pmod q$, because $\gcd(a,q)=1$ and any integer congruent to $a$ modulo $q$ is also coprime to $q$. Hence the indicator on the right-hand side is also $0$.
Now suppose $\gcd(n,q)=1$. Then both $[n]$ and $[a]$ are elements of $G$. Since $\chi(a)$ lies on the unit circle, $\overline{\chi(a)}=\chi(a)^{-1}=\chi([a]^{-1})$. Multiplicativity gives
\begin{align*}
\overline{\chi(a)}\chi(n)=\chi([a]^{-1})\chi([n])=\chi([n][a]^{-1}).
\end{align*}
We now justify the finite character orthogonality relation rather than treating it as a black box. For $g\in G$, define
\begin{align*}
S(g)=\sum_{\chi\in\widehat{G}}\chi(g).
\end{align*}
If $g=1_G$, then every character has value $1$, and there are $|G|=\varphi(q)$ characters, so $S(1_G)=\varphi(q)$. If $g\ne 1_G$, the finite abelian structure of $G$ gives a character $\psi\in\widehat{G}$ with $\psi(g)\ne 1$: decompose $G$ into cyclic factors, project to a factor where $g$ is nontrivial, and use a nontrivial root-of-unity character on that cyclic factor. Multiplication by this fixed character $\psi$ permutes $\widehat{G}$, so
\begin{align*}
S(g)=\sum_{\chi\in\widehat{G}}(\psi\chi)(g)=\psi(g)S(g).
\end{align*}
Because $\psi(g)\ne 1$, the equality forces $S(g)=0$.
Apply this with $g=[n][a]^{-1}$. If $[n][a]^{-1}=1_G$, then
\begin{align*}
\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n)=\varphi(q).
\end{align*}
If $[n][a]^{-1}\ne 1_G$, then
\begin{align*}
\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n)=0.
\end{align*}
Finally, $[n][a]^{-1}=1_G$ exactly means $[n]=[a]$, which is the congruence $n \equiv a \pmod q$. Dividing by $\varphi(q)$ proves the character-average formula for the reduced residue class indicator.[/guided]