$$\mathbb{U}_{n\in\mathbb N^*}=\left\{\exp\left(i\frac{2\pi k}{n}\right),\,0\leq k\leq n-1\right\}$$ $$\varphi(d)=\text{card}\{k\in[[1,d]],\,\text{gcd}(k,d)=1\}$$ If $z\in\mathbb U_n$, we call order of $z$ the smallest integer $d\geq1$ such that $z^d=1$.
Let $d\in[[1,n-1]]$ such that $d|n$ (say $n=dc$ for some $c\in\mathbb N$).Show that there are exactly $\varphi(d)$ elements of order $d$ in $\mathbb{U}_n$.
I'm going to use $a\wedge b\,$ for the gcd.
$[[a,b]]$ is an integer interval.
Let $z\in\mathbb U_n$ and let it be of order $d$, then
$$z^d=\exp\left[\left(i\frac{2\pi k}{n}\right)d\right]=\exp\left(i\frac{2\pi k}{c}\right)=1$$
Since $z$ is of order $d$, $k=k'c=k'\frac nd$ for some $k'\in\mathbb N$ (or else $c$ doesn't divide $k$).
Claim: For the above to hold, we require that $k'\wedge d=1$.
Proof: Suppose that $k'\wedge d>1$, then $z=\exp\left(i\frac{2\pi k}{n}\right)=\exp\left(i\frac{2\pi k'}{d}\right)$.
Because $k'\wedge d>1$, we get $z=\exp\left(i\frac{2\pi a}{b}\right)$ where $b<d$, thus the order of $z$ is at worst $b$, and could be less if $a\wedge b>1$, which goes against the first hypothesis that the order of $z$ is $d$.
In the above, I have put $k'=a(k'\wedge d)$ and $d=b(k'\wedge d)$ for some $a,\,b\in\mathbb N$.
There are $\varphi(d)$ of such $k'$, therefore:
there are exactly $\varphi(d)$ elements of order $d$ in $\mathbb{U}_n$
If anything is amiss, then please let me know. Thank you for your time!
In short, this is true because $U_n\cong\Bbb Z_n$.
And a basic fact about cyclic groups is that $|g|=d\implies |g^k|=\dfrac d{(d,k)}$. It follows by taking a generator that there's a unique cyclic subgroup of order $d$ for every $d$ dividing $n$, and that there are $\varphi(d)$ generators for that subgroup.