Solution 1:

We have $\frac{1}{1-x^k}=1+x^k+x^{2k}+x^{3k}+\cdots$. These are combined formally in a process known as generating functions.

More details, as requested. We multiply out $(1+x+x^2+x^3+\cdots)(1+x^2+x^4+x^6+\cdots)(1+x^3+x^6+x^9+\cdots)(1+x^4+x^8+\cdots)\cdots$, and gather the powers of $x$, as if they were polynomials. For example, $x^3$ has a coefficient of $3$ -- one term from $x^3\cdot 1\cdot 1\cdots$, one term from $x^1\cdot x^2\cdot 1\cdots$, and one term from $1\cdot 1\cdot x^3\cdots$. The first corresponds to $3=1+1+1$ (three 1's), the second corresponds to $3=2+1$ (one 2 and one 1), and the third corresponds to $3=3$ (one 3).