Cyclic groups have the tidiest subgroups of any groups: you can list all of them from the divisors of the order. This uses the orders of powers and one division with remainder.
Why it works
Proof. Let $G = \langle a \rangle$ and $H \le G$. If $H = \{e\}$, it is $\langle e \rangle$. Otherwise $H$ contains some $a^{k}$ with $k \ne 0$, and then also $a^{-k}$, so it contains a positive power of $a$. Let $m$ be the smallest positive integer with $a^{m} \in H$. Take any $a^{k} \in H$ and divide: $k = mq + r$ with $0 \le r \lt m$. Then $$a^{r} = a^{k}(a^{m})^{-q} \in H,$$ because $H$ is closed under products and inverses. Since $r \lt m$ and $m$ was smallest, $r = 0$. So $a^{k} = (a^{m})^{q}$, and $H = \langle a^{m} \rangle$. $\square$
Theorem (subgroups of $\mathbb{Z}_{n}$). For each positive divisor $d$ of $n$, $\mathbb{Z}_{n}$ has exactly one subgroup of order $d$, namely $\langle n/d \rangle$, and these are all its subgroups.
Why. Each subgroup is $\langle k \rangle = \langle \gcd(n, k) \rangle$, generated by a divisor $g$ of $n$, of order $n/g$. Different divisors give different orders, so there is one subgroup per order.
Counting elements by order: the elements of order $d$ are exactly the generators of the subgroup of order $d$, a cyclic group of order $d$, so there are $\varphi(d)$ of them. Adding over all divisors gives the identity $\sum_{d \mid n} \varphi(d) = n$. For $n = 12$: $\varphi(1) + \varphi(2) + \varphi(3) + \varphi(4) + \varphi(6) + \varphi(12) = 1 + 1 + 2 + 2 + 2 + 4 = 12$.
The infinite cyclic group $\mathbb{Z}$ works the same way: by the theorem, every subgroup is $\langle m \rangle = m\mathbb{Z}$, the multiples of a single $m \ge 0$. You will meet these again as the ideals of the ring $\mathbb{Z}$.
Worked example: All subgroups of $\mathbb{Z}_{20}$
- Divisors of $20$: $1, 2, 4, 5, 10, 20$.
- Subgroups $\langle 1 \rangle = \mathbb{Z}_{20}$ (order $20$), $\langle 2 \rangle$ ($10$), $\langle 4 \rangle$ ($5$), $\langle 5 \rangle$ ($4$), $\langle 10 \rangle$ ($2$), $\langle 20 \rangle = \{0\}$ ($1$).
Answer: Six subgroups, one per divisor.
Worked example: Elements of order 4 in $\mathbb{Z}_{20}$
- They generate the subgroup of order $4$, which is $\langle 5 \rangle = \{0, 5, 10, 15\}$.
- Its generators are $5 \cdot j$ with $\gcd(j, 4) = 1$: $5$ and $15$.
Answer: $5$ and $15$, that is $\varphi(4) = 2$ elements.
Common mistake
Key idea