Find the divisors of $5040$ in the Plato's dialogue "Theaetetus" In the Plato's dialogue "Theaetetus", at a certain point, we have the following "problem"
\begin{align*}
5040 &= 7! \\
&= 1\times 2 \times 3 \times 4 \times 5 \times 6 \times 7  \\
&= 2 \times 3 \times 2 \times 2 \times 5 \times 2 \times 3 \times 7 \\
&= 2^4 \times 3^2 \times 5 \times 7 \\
&=  2^4 \times 3^2 \times 5 \times 7
\end{align*}
Then we should find the number of divisors of $5040$ as $$5 \times 3 \times 2 \times 2 - 1 = 59$$
where the numbers $5, 3, 2$ and $2$ should come apparently respectively from the exponents ($+1$) of the terms in $ 2^4 \times 3^2 \times 5 \times 7$.
My questions is

Where does this formula come from exactly?

For example, I understood we can divide $5040$ by $2$, $2^2$, $2^3$, $2^4$, $3$, $3^2$, $5$ and $7$, and by any combination of products of these numbers, but I don't understand exactly what's the reasoning that has been done to obtain that formula.
I'm very bad in facing problems related to combinations and permutations. Any advice on how to improve this defect? Any specific book or set of exercises that you advise me?

There is a basic counting principle called the product rule, which says the following: in an experiment consisting of two steps, if the number of ways to do the first step is $n_1$, and the number of ways to do the second step is $n_2$ for each of the $n_1$ outcomes in the first step, then the total number of possible outcomes for the experiment is the product $n_1 n_2$. The product rule generalizes to experiments with more than $2$ steps. For example, the number of vehicle license plates consisting of three lower case letters followed by three digits is $26^3 \cdot 10^3$ because the first blank can be filled in 26 ways, the second blank can be filled in 26 ways regardless of how the first blank is filled, and so on.  
How many divisors does $2^4 \cdot 3^2 \cdot 5 \cdot 7$ have?  If $d$ is a divisor of this number, then $d$ is of the form $2^a 3^b 5^c 7^d$, where $a \in \{0,1,2,3,4\}, b \in \{0,1,2\}$ and $c, d \in \{0,1\}$.  The number of ways to choose $a$ is $5$, the number of ways to choose $b$ is $3$, and the number of ways to choose $c$ and $d$ are $2$ each.  By the product rule, we get that the number of divisors is $5 \cdot 3 \cdot 2 \cdot 2$. Of course, this includes the special case $a=b=c=d=0$ corresponding to the divisor $1$ and the special case $a=4, b=2, c=d=1$ corresponding to the divisor $5040$. If you are counting only the number of proper divisors, then $5040$ should not be counted and so we subtract $1$ from the product.
The product rule is discussed in Kenneth Rosen's text Discrete Mathematics and its Applications.
