[proofplan]
We view the representation function $r_{A+B}$ as the convolution of the indicator functions $\mathbb{1}_A:G\to\mathbb C$ and $\mathbb{1}_B:G\to\mathbb C$ declared in the theorem statement. Finite Fourier inversion expresses this convolution from its Fourier coefficients. A direct finite-sum computation gives those coefficients as $\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c)$, and separating the zero frequency produces the main term $\frac{|A||B|}{q}$.
[/proofplan]
[step:Identify the representation function as a convolution on $\mathbb Z/q\mathbb Z$]
Let $G:=\mathbb Z/q\mathbb Z$. Define the indicator functions
\begin{align*}
\mathbb{1}_A:G\to\mathbb C,\qquad x\mapsto \begin{cases}1&\text{if }x\in A,
\end{align*}
\begin{align*}
0&\text{if }x\notin A,\end{cases}
\end{align*}
and
\begin{align*}
\mathbb{1}_B:G\to\mathbb C,\qquad y\mapsto \begin{cases}1&\text{if }y\in B,
\end{align*}
\begin{align*}
0&\text{if }y\notin B.\end{cases}
\end{align*}
For functions $f,g:G\to\mathbb C$, define their convolution $f*g:G\to\mathbb C$ by
\begin{align*}
(f*g)(z):=\sum_{x\in G}f(x)g(z-x).
\end{align*}
For every $z\in G$, this gives
\begin{align*}
(\mathbb{1}_A*\mathbb{1}_B)(z)=\sum_{x\in G}\mathbb{1}_A(x)\mathbb{1}_B(z-x).
\end{align*}
The summand is $1$ exactly when $x\in A$ and $z-x\in B$, which is equivalent to the existence of the unique element $y:=z-x\in B$ with $x+y=z$. Therefore
\begin{align*}
r_{A+B}(z)=(\mathbb{1}_A*\mathbb{1}_B)(z)
\end{align*}
for every $z\in G$.
[guided]
The representation function counts ordered pairs, so the natural algebraic object behind it is convolution. We work in the finite additive group $G=\mathbb Z/q\mathbb Z$. The indicator functions are maps
\begin{align*}
\mathbb{1}_A:G\to\mathbb C,\qquad x\mapsto \begin{cases}1&\text{if }x\in A,
\end{align*}
\begin{align*}
0&\text{if }x\notin A,\end{cases}
\end{align*}
and
\begin{align*}
\mathbb{1}_B:G\to\mathbb C,\qquad y\mapsto \begin{cases}1&\text{if }y\in B,
\end{align*}
\begin{align*}
0&\text{if }y\notin B.\end{cases}
\end{align*}
For any two functions $f,g:G\to\mathbb C$, their convolution is the function $f*g:G\to\mathbb C$ given by
\begin{align*}
(f*g)(z):=\sum_{x\in G}f(x)g(z-x).
\end{align*}
Applying this definition to $f=\mathbb{1}_A$ and $g=\mathbb{1}_B$, we get
\begin{align*}
(\mathbb{1}_A*\mathbb{1}_B)(z)=\sum_{x\in G}\mathbb{1}_A(x)\mathbb{1}_B(z-x).
\end{align*}
For a fixed $x\in G$, the factor $\mathbb{1}_A(x)$ forces $x\in A$, while the factor $\mathbb{1}_B(z-x)$ forces $z-x\in B$. If we set $y:=z-x$, then the condition is exactly $(x,y)\in A\times B$ and $x+y=z$. Conversely, every pair $(x,y)\in A\times B$ with $x+y=z$ contributes exactly once, namely through its first coordinate $x$. Hence the convolution counts precisely the same ordered pairs as $r_{A+B}$:
\begin{align*}
r_{A+B}(z)=(\mathbb{1}_A*\mathbb{1}_B)(z).
\end{align*}
[/guided]
[/step]
[step:Apply finite Fourier inversion to the convolution]
Let $f:G\to\mathbb C$ be any function, and define $\widehat f:G\to\mathbb C$ by
\begin{align*}
\widehat f(c):=\sum_{x\in G}f(x)e\left(-\frac{cx}{q}\right).
\end{align*}
For any element $u\in G$, we use the finite orthogonality relation
\begin{align*}
\frac{1}{q}\sum_{c\in G}e\left(\frac{cu}{q}\right)=\begin{cases}1&\text{if }u=0\text{ in }G,
\end{align*}
\begin{align*}
0&\text{if }u\ne 0\text{ in }G.\end{cases}
\end{align*}
Indeed, if $u=0$ in $G$, every summand is $1$. If $u\ne 0$ in $G$, then $\omega:=e(u/q)\ne 1$ and $\omega^q=1$, so the finite geometric sum satisfies
\begin{align*}
\sum_{c\in G}e\left(\frac{cu}{q}\right)=\sum_{c=0}^{q-1}\omega^c=\frac{1-\omega^q}{1-\omega}=0.
\end{align*}
Therefore, for every $z\in G$,
\begin{align*}
\frac{1}{q}\sum_{c\in G}\widehat f(c)e\left(\frac{cz}{q}\right)=\frac{1}{q}\sum_{c\in G}\sum_{x\in G}f(x)e\left(\frac{c(z-x)}{q}\right).
\end{align*}
Since all sums are finite, we may interchange the two sums:
\begin{align*}
\frac{1}{q}\sum_{c\in G}\widehat f(c)e\left(\frac{cz}{q}\right)=\sum_{x\in G}f(x)\left(\frac{1}{q}\sum_{c\in G}e\left(\frac{c(z-x)}{q}\right)\right).
\end{align*}
By orthogonality, the inner parenthesis is $1$ when $x=z$ and $0$ otherwise. Hence
\begin{align*}
f(z)=\frac{1}{q}\sum_{c\in G}\widehat f(c)e\left(\frac{cz}{q}\right).
\end{align*}
Applying this to $f=r_{A+B}=\mathbb{1}_A*\mathbb{1}_B$ gives
\begin{align*}
r_{A+B}(z)=\frac{1}{q}\sum_{c\in G}\widehat{r_{A+B}}(c)e\left(\frac{cz}{q}\right).
\end{align*}
[/step]
[step:Replace the Fourier transform of the representation function by a product]
Fix $c\in G$. Since $G$ is finite, all sums below are finite and may be rearranged. Using $r_{A+B}=\mathbb{1}_A*\mathbb{1}_B$, we compute
\begin{align*}
\widehat{r_{A+B}}(c)=\sum_{z\in G}\sum_{x\in G}\mathbb{1}_A(x)\mathbb{1}_B(z-x)e\left(-\frac{cz}{q}\right).
\end{align*}
Interchanging the finite sums gives
\begin{align*}
\widehat{r_{A+B}}(c)=\sum_{x\in G}\mathbb{1}_A(x)\sum_{z\in G}\mathbb{1}_B(z-x)e\left(-\frac{cz}{q}\right).
\end{align*}
For fixed $x\in G$, use the bijection $G\to G$ given by $z\mapsto y:=z-x$. Then $z=x+y$, and the inner sum becomes
\begin{align*}
\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{c(x+y)}{q}\right)=e\left(-\frac{cx}{q}\right)\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{cy}{q}\right).
\end{align*}
Therefore
\begin{align*}
\widehat{r_{A+B}}(c)=\left(\sum_{x\in G}\mathbb{1}_A(x)e\left(-\frac{cx}{q}\right)\right)\left(\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{cy}{q}\right)\right)=\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c).
\end{align*}
Substituting this identity into the inversion formula yields
\begin{align*}
r_{A+B}(z)=\frac{1}{q}\sum_{c\in G}\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c)e\left(\frac{cz}{q}\right).
\end{align*}
[guided]
The product formula for Fourier transforms of convolutions is short enough to verify directly here. Fix a frequency $c\in G$. Because $G$ has exactly $q$ elements, every sum is finite, so changing the order of summation requires no convergence theorem.
Starting from the definition of the finite [Fourier transform](/page/Fourier%20Transform) and the identity $r_{A+B}=\mathbb{1}_A*\mathbb{1}_B$, we have
\begin{align*}
\widehat{r_{A+B}}(c)=\sum_{z\in G}r_{A+B}(z)e\left(-\frac{cz}{q}\right)=\sum_{z\in G}\sum_{x\in G}\mathbb{1}_A(x)\mathbb{1}_B(z-x)e\left(-\frac{cz}{q}\right).
\end{align*}
The inner variable $x$ records the first summand in the representation $z=x+y$. Interchanging the finite sums gives
\begin{align*}
\widehat{r_{A+B}}(c)=\sum_{x\in G}\mathbb{1}_A(x)\sum_{z\in G}\mathbb{1}_B(z-x)e\left(-\frac{cz}{q}\right).
\end{align*}
Now fix $x\in G$. Translation by $-x$ is a bijection $G\to G$, so the substitution $y:=z-x$ runs through every element of $G$ exactly once. Under this substitution $z=x+y$, and hence
\begin{align*}
\sum_{z\in G}\mathbb{1}_B(z-x)e\left(-\frac{cz}{q}\right)=\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{c(x+y)}{q}\right).
\end{align*}
The exponential factor splits because $e(s+t)=e(s)e(t)$ for [real numbers](/page/Real%20Numbers) $s,t$, with the values independent of the chosen integer representatives modulo $q$. Thus
\begin{align*}
\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{c(x+y)}{q}\right)=e\left(-\frac{cx}{q}\right)\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{cy}{q}\right).
\end{align*}
Substituting this expression back into the outer sum gives
\begin{align*}
\widehat{r_{A+B}}(c)=\left(\sum_{x\in G}\mathbb{1}_A(x)e\left(-\frac{cx}{q}\right)\right)\left(\sum_{y\in G}\mathbb{1}_B(y)e\left(-\frac{cy}{q}\right)\right).
\end{align*}
By the definition of the finite Fourier transform, the two factors are $\widehat{\mathbb{1}_A}(c)$ and $\widehat{\mathbb{1}_B}(c)$. Therefore
\begin{align*}
\widehat{r_{A+B}}(c)=\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c).
\end{align*}
Putting this into the [Fourier inversion formula](/theorems/528) from the previous step gives
\begin{align*}
r_{A+B}(z)=\frac{1}{q}\sum_{c\in G}\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c)e\left(\frac{cz}{q}\right).
\end{align*}
[/guided]
[/step]
[step:Separate the zero frequency from the nonzero frequencies]
At the zero frequency $0\in G$, the Fourier transforms are
\begin{align*}
\widehat{\mathbb{1}_A}(0)=\sum_{x\in G}\mathbb{1}_A(x)=|A|
\end{align*}
and
\begin{align*}
\widehat{\mathbb{1}_B}(0)=\sum_{y\in G}\mathbb{1}_B(y)=|B|.
\end{align*}
Also $e(0z/q)=1$. Thus the $c=0$ term in the Fourier expansion is
\begin{align*}
\frac{1}{q}\widehat{\mathbb{1}_A}(0)\widehat{\mathbb{1}_B}(0)e\left(\frac{0z}{q}\right)=\frac{|A||B|}{q}.
\end{align*}
Separating this term from the remaining frequencies gives
\begin{align*}
r_{A+B}(z)=\frac{|A||B|}{q}+\frac{1}{q}\sum_{\substack{c\in G, \, c\ne 0}}\widehat{\mathbb{1}_A}(c)\widehat{\mathbb{1}_B}(c)e\left(\frac{cz}{q}\right).
\end{align*}
This is the desired [representation formula](/theorems/39) for every $z\in\mathbb Z/q\mathbb Z$.
[/step]