So there in alternative proof illustrated in my text it goes:
$$\sum_{a=1,(a,n)=1}^n e^{2\pi ia/n} = \sum_{a=1}^n e^{\frac{2\pi ia}{n}}\sum_{d|(a,n)}\mu(d)---(1)$$ $$=\sum_{a=1}^n\sum_{d|(a,n)} e^{\frac{2\pi ia}{n}}\mu(d)---(2)$$ $$=\sum_{d|n}\sum_{m=1}^{n/d} e^{\frac{2\pi ia}{n}}\mu(d)---(3)$$
Now my question is, why the continuous changes on the summands possible, and also why is the $(1)$ possible with the Mobius function, how does it equate Im confused. And for $(2)$, why the combination of summands possible? And for $(3)$, how come the first sum is just on $\sum_{d|n}$?? then we can suddenly change it to $\sum_{m=1}^{n/d}$ or the sum of $(3)$? Im in general very confused with the continuous changing of the bounds on the sum when dealing with arithmetic function. I really would appreciate the explanation.
$$\sum_{a=1,(a,n)=1}^n e^{\textstyle\frac{2\pi ia}{n}} =\sum_{a=1}^n e^{\textstyle\frac{2\pi ia}{n}} 1_{(a,n)=1}= \sum_{a=1}^n e^{\textstyle\frac{2\pi ia}{n}}\sum_{d|(a,n)}\mu(d)$$ $$= \sum_{a=1}^n e^{\textstyle\frac{2\pi ia}{n}}\sum_{d | n}1_{d | a}\mu(d)=\sum_{d | n}\mu(d)\sum_{a=1}^n e^{\textstyle\frac{2\pi ia}{n}}1_{d | a}=\sum_{d | n}\mu(d)\sum_{b=1}^{n/d} e^{\textstyle\frac{2\pi i(bd)}{n}}$$
Where I used the definition of the Möbius function as the Dirichlet inverse of $f(m)=1$ : $$\sum_{d | m} \mu(d) = 1_{m=1}$$
Of course for $n/d > 1$, the geometric sum simplifies $\sum_{b=1}^{n/d} e^{\textstyle\frac{2\pi ib}{n/d}}= \frac{e^{\textstyle\frac{2\pi i n/d}{n/d}}-1}{e^{\textstyle\frac{2\pi i}{n/d}}-1} = 0$, so that $$\sum_{d | n}\mu(d)\sum_{b=1}^{n/d} e^{\textstyle\frac{2\pi i(bd)}{n}} = \sum_{d | n}\mu(d)1_{n/d = 1} = \mu(n)$$