<s>[INST] If I roll three dice at the same time, how many ways the sides can sum up to $13$? If I rolled $3$ dice how many combinations are there that result in sum of dots appeared on those dice be $13$?
 [/INST] Expanding the answer of Henno Brandsma: a generating function is a way to pack a sequence as the coefficients of the power expansion of a function, by example we can pack the Fibonacci sequence as the coefficients on the power expansion of the function $h(x):=\frac1{1-x-x^2}$.
The important point here is that the algebra of generating functions (product, sum, etc.) is a handy way to compose the coefficients packed in them to get a new generating function with coefficients that are of interest to us.
By example the polynomial
$$
p(x):=a_0x^0+a_1x^1+a_2x^2+\ldots+a_n x^n
$$
is the generating function that contains the sequence $a_0,a_1,\ldots,a_n$.
In our case each side of a standard fair dice appears just once in the dice, that is, there is only one side with a given number, from one to six. Therefore the generating function
$$
f(x):= x^1+x^2+x^3+x^4+x^5+x^6
$$
pack the sequence of number of sides of a fair die (note that the power of each monomial represent one of the sides of a dice).
Now: multiplication of generating functions have the effect that the new sequence, after multiplication, is a sum of products of the old ones, where the indices of every product in each sum add up to the exponent of the monomial that will accompany.
Its easy to check that, as we are throwing three dice, then the generating function
$$g(x):=f(x)^3=(x^1+x^2+x^3+x^4+x^5+x^6)^3$$
pack as coefficients the total amounts of different ways to add up to the exponent of each monomial.
Now: the polynomial $f$ can be seen as the partial sum of a geometric series, i.e.
$$
\begin{align*}
f(x)&=x^1+x^2+x^3+x^4+x^5+x^6\\
&=x(x^0+x^1+x^2+x^3+x^4+x^5)\\
&=x\sum_{k=0}^{5}x^k\\
&=x\frac{1-x^6}{1-x}
\end{align*}
$$
Then $$g(x)=x^3\left(\frac{1-x^6}{1-x}\right)^3=x^3\color{red}{(1-x^6)^3}\color{green}{(1-x)^{-3}}$$
The colored expressions (red and green) can be expressed as binomial series[*]. Then
$$\require{cancel} g(x)=x^3\color{red}{\sum_{j=0}^{3}(-1)^j\binom{3}{j}x^{6j}}\color{green}{\sum_{h=0}^{\infty}(-1)^h\binom{-3}{h}x^h}$$
Now: as we know that $\binom{-3}{h}=(-1)^h\binom{3+h-1}{h}=(-1)^h\binom{h+2}{2}$ (to understand this equality you can see here, and remember that $\binom{n}{k}=\binom{n}{n-k}$), then we find that
$$g(x)=x^3\color{red}{\sum_{j=0}^{3}(-1)^j\binom{3}{j}x^{6j}}\color{green}{\sum_{h=0}^{\infty}\cancel{(-1)^h}\cancel{(-1)^h}\binom{h+2}{2}x^h}$$
From here we can build a formula to know the coefficient for any exponent of $x$. First note that any exponent of $x$ will be of the form $S=3+6j+h$, so $h=S-3-6j$, and the coefficient for any sum $S$ will be
$$[x^S]g(x)=1\cdot\sum_{j=0}^{3}\color{red}{(-1)^j\binom{3}{j}}\color{green}{\binom{S-3-6j+2}{2}}\\
=\sum_{j=0}^{3}\color{red}{(-1)^j\binom{3}{j}}\color{green}{\binom{S-1-6j}{2}}$$
where the notation $[x^k]f(x)$ represent the coefficient that the power $x^k$ have in the function $f$.
We can use this last formula to know the amount of ways to obtain a sum $S$ throwing three dice, in our case for $S=13$. Indeed the previous formula can be written in a more precise way: observe that if $S-1-6j<2$ (green binomial) or $j>3$ (red binomial) then the addend will be zero, because if $n<k$ for $n,k\in\Bbb N$ then $\binom{n}{k}=0$. Hence the addends of the sum are not zero when $S-1-6j\ge 2$ and $3\ge j$. And the values of $j$ where the addends are not zero are determined by
$$S-1-6j\geq 2 \implies j\leq\frac{S-3}{6}\le\frac{18-3}6<3\implies j\le 3,\quad S\in\{3,4,\ldots,18\}$$
Then we can re-write $[x^S]g(x)$ as
$$\bbox[5px,border:2px solid gold]{[x^S]g(x)=\sum_{j=0}^{\lfloor\frac{S-3}{6}\rfloor}(-1)^j\binom{3}{j}\binom{S-1-6j}{2}}$$
I hope you understand all information. Anyway surely you must read some more info to understand completely this answer. Just to clarify: the notation $\lfloor x\rfloor$ is the representation of the floor function.
To complete the question, we will evaluate $[x^{13}]g(x)$:
$$
\begin{align*}[x^{13}]g(x)&=\sum_{j=0}^{1}(-1)^j\binom{3}{j}\binom{12-6j}{2}\\
&=\binom{3}{0}\cdot\binom{12}{2}-\binom{3}{1}\binom{6}{2}\\
&=1\cdot \frac{\cancelto{6}{12}\cdot 11}{\cancel{2}}-3\cdot \frac{\cancelto{3}{6}\cdot 5}{\cancel{2}}\\
&=6\cdot 11 - 9\cdot 5\\
&=21
\end{align*}$$

[*] Observe that for $n\in\Bbb N$
$$(x+y)^n=\sum_{k=0}^\infty\binom{n}{k}x^ky^{n-k}=\sum_{k=0}^n\binom{n}{k}x^ky^{n-k}$$
then although the second sum is finite it represent a binomial series with infinite addends that are zero.
</s>