[step:Decompose $\sigma$ into disjoint cycles from its finite orbits]
Let $X:=\{1,\dots,n\}$, and define a relation $\sim$ on $X$ by declaring that, for $x,y \in X$,
\begin{align*}
x \sim y \quad \text{if and only if} \quad y=\sigma^q(x) \text{ for some } q \in \mathbb{Z}.
\end{align*}
This is an [equivalence relation](/page/Equivalence%20Relation) because $\sigma^0=\operatorname{id}_X$, because $\sigma^{-q}$ is the inverse power of $\sigma^q$, and because $\sigma^{q+r}=\sigma^q \circ \sigma^r$ for all $q,r \in \mathbb{Z}$.
Let $O_1,\dots,O_s$ be the distinct equivalence classes for this relation. For each $i \in \{1,\dots,s\}$, choose an element $a_{i,1} \in O_i$. Since $O_i$ is finite, there is a least integer $k_i \geq 1$ such that $\sigma^{k_i}(a_{i,1})=a_{i,1}$. Define
\begin{align*}
a_{i,j}:=\sigma^{j-1}(a_{i,1}) \quad \text{for } j \in \{1,\dots,k_i\}.
\end{align*}
Then the elements $a_{i,1},\dots,a_{i,k_i}$ are distinct by the minimality of $k_i$, and
\begin{align*}
O_i=\{a_{i,1},\dots,a_{i,k_i}\}.
\end{align*}
On $O_i$, the permutation $\sigma$ acts by
\begin{align*}
a_{i,1}\mapsto a_{i,2},\quad a_{i,2}\mapsto a_{i,3},\quad \dots,\quad a_{i,k_i-1}\mapsto a_{i,k_i},\quad a_{i,k_i}\mapsto a_{i,1}.
\end{align*}
Thus the restriction of $\sigma$ to $O_i$ is the cycle $(a_{i,1}\ a_{i,2}\ \cdots\ a_{i,k_i})$, with the convention that a $1$-cycle fixes its single element. Since the classes $O_i$ are disjoint and cover $X$, $\sigma$ is the product of these disjoint cycles.
[/step]