10. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=2$, and the sum of the first $n$ terms is $S_{n}$. If $\left(n^{2}+1\right) \cdot a_{n+1}=(2 n+1) \cdot S_{n}+n^{4}$ $+2 n^{3}+3 n^{2}+2 n+2$, find the expressions for $S_{n}$ and $a_{n}$ (expressed in the simplest form involving $n$).
10. Solution: Since $a_{n+1}=S_{n+1}-S_{n} (n \geqslant 1)$,

we have $\left(n^{2}+1\right) \cdot\left(S_{n+1}-S_{n}\right)=(2 n+1) \cdot S_{n}+n^{4}+2 n^{3}+3 n^{2}+2 n+2$,
$$
\begin{array}{l}
\left(n^{2}+1\right) \cdot S_{n+1}-\left(n^{2}+2 n+2\right) \cdot S_{n}=n^{4}+2 n^{3}+3 n^{2}+2 n+2, \\
\left(n^{2}+1\right) \cdot S_{n+1}-\left[(n+1)^{2}+1\right] \cdot S_{n}=\left(n^{2}+1\right) \cdot\left[(n+1)^{2}+1\right],
\end{array}
$$

Therefore, $\frac{S_{n+1}}{(n+1)^{2}+1}-\frac{S_{n}}{n^{2}+1}=1$, which means $\left\{\frac{S_{n}}{n^{2}+1}\right\}$ is an arithmetic sequence with a common difference of 1.
Given $S_{1}=a_{1}=2$ and the general term formula of the arithmetic sequence, we have: $\frac{S_{n}}{n^{2}+1}=\frac{S_{1}}{1^{2}+1}+(n-1) \cdot 1=n$,
so $S_{n}=n \cdot\left(n^{2}+1\right) \quad(n=1,2,3, \cdots)$,
When $n \geqslant 2$, $a_{n}=S_{n}-S_{n-1}=n \cdot\left(n^{2}+1\right)-(n-1) \cdot\left[(n-1)^{2}+1\right]=3 n^{2}-3 n+2$,
When $n=1$, $a_{1}=2=3 \times 1^{2}-3 \times 1+2$. In summary, the required $a_{n}=3 n^{2}-3 n+2 \quad(n=1,2,3, \cdots)$.