We bascially replace the index variable (which in the case of our sums is \(n\)) with something else.
Since we want to match the powers of \(x\text{,}\) let's write \(n = k+2\) in the first sum above. That way, we'd have
\begin{align*}
\sum_{n=0}^\infty n(n-1)a_nx^{n-2} \amp = \sum_{k+2=0}^\infty (k+2)(k+2-1)a_{k+2}x^{k+2-2} = \sum_{k=-2}^\infty (k+2) (k+1) a_{k+2} x^k.
\end{align*}
The \(k = -2\) is a little scary, but notice that \((k+2) (k+1) a_{k+2} x^k = 0\) when \(k = -2\) and when \(k = -1\text{.}\) So, we can rewrite the sum as
\begin{align*}
\sum_{k=-2}^\infty (k+2) (k+1) a_{k+2} x^k \amp = \sum_{k=0}^\infty (k+2) (k+1) a_{k+2} x^k = \sum_{n=0}^\infty (n+2) (n+1) a_{n+2} x^n,
\end{align*}
where in the last step, we've just replaced all the \(k\)'s with \(n\)'s.
Remember our recurrence relation:
\begin{gather*}
(n+2)(n+1) a_{n+2} + (2n+1)a_n = 0 \quad \implies \quad a_{n+2} = - \frac{2n+1}{(n+2)(n+1)} a_n.
\end{gather*}
Now, we just need to plug in certain values of \(n\text{.}\) (Don't forget that \(a_0\) and \(a_1\) are arbitrary.)
\begin{align*}
a_2 \amp = - \frac{2(0) + 1}{(0 + 2)(0 + 1)} a_0 = -\frac12 a_0,\\
a_3 \amp = - \frac{2(1) + 1}{(1 + 2)(1 + 1)} a_1 = -\frac12 a_1,\\
a_4 \amp = - \frac{2(2) + 1}{(2 + 2)(2 + 1)} a_2 = -\frac5{12} \cdot -\frac12 a_0 = \frac5{24} a_0,\\
a_5 \amp = - \frac{2(3) + 1}{(3 + 2)(3 + 1)} a_3 = -\frac7{20} \cdot -\frac12 a_1 = \frac7{40} a_1.
\end{align*}
So, the first six terms of \(y(x)\) are
\begin{gather*}
a_0 + a_1x - \frac12 a_0 x^2 - \frac12 x^3 + \frac5{24} a_0x^4 + \frac7{40} a_1 x^5.
\end{gather*}
This is usually something that you'd rarely have to do. We have to consider different cases based on whether \(n = 2k\) is even or if \(n = 2k+1\) is odd.
Our recurrence relation tells us that \(a_n = f(n) a_{n-2}\) where
\begin{align*}
f(n) \amp = - \frac{2(n-2)+1}{((n-2)+2)((n-2)+1)} = -\frac{2n-3}{n(n-1)}.
\end{align*}
When \(n = 2k\) is even, we find that
\begin{align*}
a_{2k} \amp = f(2k) a_{2k-2} = f(2k) f(2k-2) a_{2k-4}, \phantom{\frac12} \\
\amp = f(2k) f(2k-2) f(2k-4) \cdots f(4) f(2) a_0,\\
\amp = a_0 \prod_{s=1}^k f(2s), \\
\amp = a_0 \prod_{s=1}^k \left[-\frac{4s-3}{2s(2s-1)}\right], \\
\amp = a_0 \frac{(-1)^k}{(2k)!} \prod_{s=1}^k (4s-3).
\end{align*}
When \(n = 2k+1\) is odd, we find that
\begin{align*}
a_{2k+1} \amp = f(2k+1) a_{2k-1} = f(2k+1) f(2k-1) a_{2k-3}, \phantom{\frac12} \\
\amp = f(2k+1) f(2k-1) f(2k-3) \cdots f(5) f(3) a_1,\\
\amp = a_1 \prod_{s=1}^k f(2s+1),\\
\amp = a_1 \prod_{s=1}^k \left[-\frac{4s-1}{(2s+1)2s}\right],\\
\amp = a_1 \frac{(-1)^k}{(2k+1)!} \prod_{s=1}^k (4s-1).
\end{align*}
Put together, we get the explicit form of \(a_n\text{.}\)