I understand why the following theorem holds:
If $R$ is a PID and $M$ is a finitely-generated torsion $R$-module, then there exist $q_1,...,q_s$, non-invertible elements of $R$, such that $q_i \mid q_{i+1}$ for all $i=1,...,s-1$ and:
$$M \cong \prod_{i=1}^s R/Rq_i$$
Moreover, if $q_1 ',...,q_{s'} ' \in R$ satisfy the same hypothesis as the $q_i$'s and $M \cong \prod_{i=1}^{s'} R/Rq_i$, then $s=s'$ and $Rq_i = Rq_i '$ for all $i$.
The $q_i$'s in the theorem are called the invariant factors of the module $M$.
I would like to know, though, why is it useful to know the invariant factors?
For an example of how it is useful, let $R=F[X]$ for $F$ a field, and let $V$ be a finite-dimensional $F$-vector space and $T$ a linear operator on $V$. Then $V$ can be made into an $F[X]$-module by letting $X$ act via $T$, and the decomposition $$ V\simeq F[X]/(q_1(X))\oplus \dots\oplus F[X]/(q_s(X)) $$ gives you the rational canonical form of $T$. Moreover, $q_s(X)$ is the minimal polynomial of $T$.
Another common application is to determine the structure of a quotient of $\mathbb{Z}^n$ by some (rank $n$) subgroup $M$, using the Smith normal form of a matrix.