[proofplan]
We expand the product of the finite exponential sums and interchange the finite summation with the integral. Each tuple $(a_1,\dots,a_k)$ then contributes the integral of the integer character $\alpha\mapsto e((a_1+\cdots+a_k-m)\alpha)$ over $[0,1]$. A direct orthogonality computation shows that this integral is $1$ exactly when $a_1+\cdots+a_k=m$ and is $0$ otherwise. Summing these indicator contributions gives precisely the representation count $R(m)$.
[/proofplan]
[step:Expand the finite product inside the integral]
For each $\alpha\in[0,1]$, the definition of the functions $S_{A_i}:[0,1]\to\mathbb C$ gives
\begin{align*}
S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
e(a_1\alpha)\cdots e(a_k\alpha)e(-m\alpha).
\end{align*}
Since $e(x+y)=e(x)e(y)$ for all $x,y\in\mathbb R$, this becomes
\begin{align*}
S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
e((a_1+\cdots+a_k-m)\alpha).
\end{align*}
For each tuple $(a_1,\dots,a_k)\in A_1\times\cdots\times A_k$, the map $[0,1]\to\mathbb C$ given by $\alpha\mapsto e((a_1+\cdots+a_k-m)\alpha)$ is continuous, hence Lebesgue integrable on $[0,1]$. The set $A_1\times\cdots\times A_k$ is finite, so finite additivity and linearity of the [Lebesgue integral](/page/Lebesgue%20Integral) give
\begin{align*}
\int_0^1 S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)\,d\mathcal L^1(\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
\int_0^1 e((a_1+\cdots+a_k-m)\alpha)\,d\mathcal L^1(\alpha).
\end{align*}
[guided]
The first move is to make the coefficient extraction explicit. For a fixed $\alpha\in[0,1]$, each factor $S_{A_i}(\alpha)$ is a finite sum:
\begin{align*}
S_{A_i}(\alpha)=\sum_{a_i\in A_i}e(a_i\alpha).
\end{align*}
Multiplying the $k$ finite sums means choosing one element $a_i\in A_i$ from each set. Therefore
\begin{align*}
S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
e(a_1\alpha)\cdots e(a_k\alpha)e(-m\alpha).
\end{align*}
The exponential notation is multiplicative under addition, because
\begin{align*}
e(x)e(y)=\exp(2\pi i x)\exp(2\pi i y)=\exp(2\pi i(x+y))=e(x+y).
\end{align*}
Applying this identity repeatedly gives
\begin{align*}
e(a_1\alpha)\cdots e(a_k\alpha)e(-m\alpha)
=
e((a_1+\cdots+a_k-m)\alpha).
\end{align*}
Thus
\begin{align*}
S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
e((a_1+\cdots+a_k-m)\alpha).
\end{align*}
For each tuple $(a_1,\dots,a_k)\in A_1\times\cdots\times A_k$, the map $[0,1]\to\mathbb C$ given by $\alpha\mapsto e((a_1+\cdots+a_k-m)\alpha)$ is continuous, so it is Lebesgue integrable on $[0,1]$. The interchange of summation and integration has no convergence issue, because the Cartesian product $A_1\times\cdots\times A_k$ is finite. Hence linearity of the Lebesgue integral on $[0,1]$ gives
\begin{align*}
\int_0^1 S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)\,d\mathcal L^1(\alpha)
=
\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}
\int_0^1 e((a_1+\cdots+a_k-m)\alpha)\,d\mathcal L^1(\alpha).
\end{align*}
[/guided]
[/step]
[step:Compute the orthogonality integral for each integer frequency]
Define the orthogonality integral map
\begin{align*}
I:\mathbb Z\to\mathbb C,\quad n\mapsto \int_0^1 e(n\alpha)\,d\mathcal L^1(\alpha).
\end{align*}
If $n=0$, then $e(n\alpha)=1$ for every $\alpha\in[0,1]$, so
\begin{align*}
I(0)=\int_0^1 1\,d\mathcal L^1(\alpha)=1.
\end{align*}
If $n\ne 0$, define the functions
\begin{align*}
g_n:[0,1]\to\mathbb C,\quad \alpha\mapsto \exp(2\pi i n\alpha)
\end{align*}
and
\begin{align*}
G_n:[0,1]\to\mathbb C,\quad \alpha\mapsto (2\pi i n)^{-1}\exp(2\pi i n\alpha).
\end{align*}
The function $g_n$ is continuous, the function $G_n$ is continuously differentiable, and $G_n'(\alpha)=g_n(\alpha)$ for every $\alpha\in[0,1]$. Applying the [Fundamental Theorem of Calculus](/theorems/632) to the real and imaginary parts of the continuously differentiable function $G_n$ gives
\begin{align*}
I(n)=\int_0^1 \exp(2\pi i n\alpha)\,d\mathcal L^1(\alpha)=G_n(1)-G_n(0)=\frac{\exp(2\pi i n)-1}{2\pi i n}.
\end{align*}
Since $n\in\mathbb Z$, $\exp(2\pi i n)=1$, and therefore
\begin{align*}
I(n)=0.
\end{align*}
Thus, for every $n\in\mathbb Z$, the integral $I(n)$ equals $1$ if $n=0$ and equals $0$ if $n\ne 0$.
[/step]
[step:Identify the surviving tuple contributions with the representation count]
Define the integer-valued map
\begin{align*}
n:A_1\times\cdots\times A_k\to\mathbb Z,\quad (a_1,\dots,a_k)\mapsto a_1+\cdots+a_k-m.
\end{align*}
By the orthogonality computation from the previous step, for each tuple $a=(a_1,\dots,a_k)\in A_1\times\cdots\times A_k$, the integral $\int_0^1 e(n(a)\alpha)\,d\mathcal L^1(\alpha)$ equals $1$ if $a_1+\cdots+a_k=m$ and equals $0$ if $a_1+\cdots+a_k\ne m$.
Define the indicator function
\begin{align*}
\mathbb{1}_{\{a_1+\cdots+a_k=m\}}:A_1\times\cdots\times A_k\to\{0,1\}
\end{align*}
by assigning value $1$ to a tuple $(a_1,\dots,a_k)$ whose coordinates satisfy $a_1+\cdots+a_k=m$, and value $0$ otherwise. Therefore
\begin{align*}
\int_0^1 S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)\,d\mathcal L^1(\alpha)=\sum_{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k}\mathbb{1}_{\{a_1+\cdots+a_k=m\}}(a_1,\dots,a_k).
\end{align*}
The final sum counts exactly the elements of
\begin{align*}
\{(a_1,\dots,a_k)\in A_1\times\cdots\times A_k:a_1+\cdots+a_k=m\}.
\end{align*}
Hence it is equal to $R(m)$, and so
\begin{align*}
R(m)=\int_0^1 S_{A_1}(\alpha)\cdots S_{A_k}(\alpha)e(-m\alpha)\,d\mathcal L^1(\alpha).
\end{align*}
This proves the formula.
[/step]