I try to understand a number theoretical identity used by 
Jan-Christoph Schlage-Puchta in this [answer][1].

He defined the function

$$S(\alpha)=\sum_{n\leq N}\Lambda(n) e(n\alpha)$$

where $\Lambda(n)$ is the 
 [Mangoldt function][2] and $e(x)$ the exponential $e(x)=e^{2\pi i x}$.

Assume $\alpha=\frac{p}{q}$ is rational, and $p:= p_1 p_2...p_n$ and 
$q:= q_1 ...p_m$ are *coprime* positive integers where $p_i$ and
$q_j$ are primes such that every pair $p_i, q_j$ is pair wise different.

Why the following identity is true:


$$\sum_{n\leq N}\Lambda(n) e(n\alpha) = 
\sum_{(a,q)=1} e(\frac{ap}{q})\underset{n\equiv a\pmod{q}}{\sum_{n\leq N}} \Lambda(n)$$


  [1]: https://mathoverflow.net/questions/161947/what-keeps-asymptotic-goldbachs-conjecture-out-of-reach-of-current-technology/162085#162085
  [2]: https://en.wikipedia.org/wiki/Von_Mangoldt_function