I want to understand the induction proof of
$$\sum_{k=1}^n(2k-1)^2 = \frac{1}{3}n (2n-1)(2n+1), n \geq 1$$
Here's the induction steps:
$$\sum_{k=1}^{n+1}(2k-1)^2 = \sum_{k=1}^n(2k-1)^2 + (2(n+1)-1)^2$$
$$= \frac{1}{3}n (2n-1)(2n+1)+(2n+2-1)^2$$
$$=\frac{1}{3}(2n+1)(n(2n-1)+3\cdot(2n+1))$$
$$=\frac{1}{3} (2n+1)(2n^2+5n+3)$$
$$=\frac{1}{3}(2n+1)(2n+3)(n+1)$$
What I don't understand is how you get from $$= \frac{1}{3}n (2n-1)(2n+1)+(2n+2-1)^2$$
to
$$=\frac{1}{3}(2n+1)(n(2n-1)+3\cdot(2n+1))$$
We have that
$$\ldots= \frac{1}{3}n (2n-1)(2n+1)+(2n+2-1)^2=\frac{1}{3}n (2n-1)(2n+1)+(2n+1)^2=$$
$$=\frac{1}{3}(2n+1)\cdot\left[n (2n-1)+3(2n+1)\right]=\ldots$$
which is obtained factoring out the $\frac{1}{3}(2n+1)$ term.