Understanding Generating Function I have been looking at This Problem and Answer about generating functions. The problem asked for the generating function of: $$a_n=4a_{n-1}-4a_{n-2}+{n\choose 2}2^n+1$$ I understand how Ron Gordon simplified it to: $$\sum_{n=2}^{\infty} (a_n-4 a_{n-1}+4 a_{n-2}) x^n = \sum_{n=2}^{\infty} n(n-1)2^{n-1} x^n + \sum_{n=2}^{\infty} x^n$$ and where he defined the generating function as: $$g(x) = \sum_{n=0}^{\infty} a_n x^n$$but then he broke the summation into $3$ seperate summations and this is where I start to get messed up. I do understand in the first summation how we can get: $$\sum_{n=2}^\infty a_nx^n=\sum_{n=0}^\infty a_nx^n-(a_0+a_1x)$$I don't understand the next two summations though.
Question: 
1) In the second and third summation where did the $x$ and $x^2$ come from?
2) Do you always multiply by $x^n$ in generating functions? or does it change?
3) I believe I remember my professor saying that every generating function would always be $f(x)=\sum_{n=0}^na_nx^n$ but why is that the case?
4) I guess my overall trouble is understanding what the goal of a generating function is. 
Any help would be much appreciated!
(I have looked at other questions, but I can't find a clear answer. So if there is one out there that I missed that answers this I'd be happy to delete my question. Thanks.)

Easiest is to define:
$$
A(z) = \sum_{n \ge 0} a_n z^n
$$
then shift indices so there aren't subtractions there:
$$
a_{n + 2} = 4 a_{n + 1} - 4a_n + \binom{n + 2}{2} 2^{n + 2} + 1
$$
Multiply by $z^n$ and sum over $n \ge 0$:
$$
\sum_{n \ge 0} a_{n + 2} z^n
  = 4 \sum_{n \ge 0} a_{n + 1} z^n - 4 \sum_{n \ge 0} a_n z^n
     + \sum_{n \ge 0} \binom{n + 2}{2} 2^{n + 2} + \sum_{n \ge 0} z^n
$$
We recognize:
$\begin{align}
\sum_{n \ge 0} a_{n + k} z^n
  &= \frac{A(z) - a_0 - a_1 z - \dotsb - a_{k - 1} z^{k - 1}}{z^k} \\
\sum_{n \ge 0} \binom{n + 2}{2} 2^{n + 2}
  &= \sum_{n \ge 0} \binom{n}{2} 2^n z^n \\
  &= \frac{(2 z)^2}{(1 - 2 z)^3} \\
\sum_{n \ge 0} z^n
  &= \frac{1}{1 - z}
\end{align}$
Replace in the sum above:
$$
\frac{A(z) - a_0 - a_1 z}{z^2}
  = 4 \frac{A(z) - a_0}{z}
      - 4 A(z)
      + \frac{(2 z)^2}{(1 - 2 z)^3} - 1 - 4 z
      + \frac{1}{1 - z}
$$
Solve for $A$:
$$
A(z)
  = \frac{a_0 
             + (a_1 + 11 a_0) z
             - (7 a_1 - 46 a_0 - 1) z^2
             + (18 a_1 - 92 a_0 - 6) z^3
             - (20 a_1 - 88 a_0 - 16) z^4
             + (8 a_1 - 32 a_0 - 12) z^5
          }
          {1 - 11 z + 50 z^2 - 120 z^3 + 160 z^4 - 112 z^5 + 32^6}
$$
Expand this as partial fractions, and read off the coefficients.
