2. Given the general term of the sequence $\left\{a_{n}\right\}$
$$
a_{n}=\frac{(n+1)^{4}+n^{4}+1}{(n+1)^{2}+n^{2}+1} \text {. }
$$

Then the sum of the first $n$ terms of the sequence $\left\{a_{n}\right\}$, $S_{n}=$ $\qquad$
$\begin{array}{l}\text { 2. } \frac{1}{3} n\left(n^{2}+3 n+5\right) . \\ S_{n}=\sum_{k=1}^{n}\left(k^{2}+k+1\right) \\ =\frac{n(n+1)(2 n+1)}{6}+\frac{n(n+1)}{2}+n \\ =\frac{1}{3} n\left(n^{2}+3 n+5\right) .\end{array}$