I know the basic formulas which are:
For a number $n = p_1^{a_1} p_2^{a_2} \cdot \ldots \cdot p_k^{a_k}$, we have $d(n) = ( a_1 + 1 )( a_2 + 1 ) \cdot \ldots \cdot (a_k+1)$ and $S(n) = \frac{p_1^{a_1+1} - 1}{p_1-1} \cdot \frac{p_2^{a_2+1} - 1}{p_2-1} \cdot \ldots \cdot \frac{p_k^{a_k+1} - 1}{p_k-1}$
I found some demonstrations but none close to my level of maths understanding.I want a simple description of how those formulas were found. Basically, explain everything.
I'll write about $d(n)$, but this reasoning can probably be extended to $S(n)$.
Every divisor of $n$ will be of the form $p_1^{b_1}\cdots p_k^{b_k}$, where $0 \leqslant b_i \leqslant a_i$. Each choice of $b$ gives a divisor, and vice versa. Every $b_i$ is independent, and has a range of $a_i + 1$ possible values, hence $d(n) = \Pi_{i=1}^k (a_i+1)$.