Generating Function Example from class Example: Consider the sequence $(h_n)$ where $h_n$ is the number of nonnegative integer solutions to $$a_1+a_2+a_3+a_4+a_5=n.,$$ where $a_1$ is even, $a_2$ is odd, $a_3$ is a multiple of $5$, $a_4$ is 1,3, or 7, and $a_5$ is 0 or 1.
Without clear explaination, my professor writes $$(1+x^2+x^4\dots)(x+x^3+x^5+\dots)(1+x^5+x^{10}+\dots)(x+x^3+x^7)(1+x)=\sum_{a_1+a_2+a_3+a_4+a_5=0}^{\infty} x^{a_1+a_2+a_3+a_4+a_5},$$ where the $a_i$s respect the conditions stated above. We can simplify to $\frac{x(1+x)(x+x^3+x^7)}{(1-x^2)^2(1-x^5)}.$
My question: where did the first five generating functions come from? I see the relation between the exponents and the $a_i$s but how does one formally obtain these new generating functions and why are all of their coefficients 0 or 1?

In this generating function, the things representing the solutions are the exponents. The condition that $a_1$ is even means that it can be $0, 2, 4, 6, \ldots$. Your professor therefore associates it to the even powers $(1 + x^2 + x^4 + \ldots)$. It's similar for the other cases.
Now, if you understand how multiplication works (distribution) and think about it, you can recognize that the coefficient of $x^n$ in the product is exactly the number of ways of adding $a_1 + \ldots + a_5$ to get $n$. Why? Let's look at a few of the small cases.
In how many ways can we get $a_1 + \ldots + a_5 = 2$? Looking at them, we know there is exactly one (when $a_2 = a_4 = 1$). Similarly, in $$(1+x^2+x^4\dots)(x+x^3+x^5+\dots)(1+x^5+x^{10}+\dots)(x+x^3+x^7)(1+x)$$
we see that the only way to get the exponent $2$ is to choose $1$ from the first, $x$ from the second, $1$ from the third, $x$ from the fourth, and $1$ from the last. Thus the coefficient of $x^2$ in the answer will be $1$. If we were to do this for another, say $n=4$ (or in our problem, the coefficient of $x^4$), you can directly show that for every solution in the $a_i$ there is a corresponding choice of terms whose exponents yield that solution in the product.
Thus the number of solutions for $\sum a_i = n$ will be the coefficient of $x^n$ in the expansion of $(1+x^2+x^4\dots)(x+x^3+x^5+\dots)(1+x^5+x^{10}+\dots)(x+x^3+x^7)(1+x)$.
