2. Let $n \geq 2$ be a positive integer, and let $a_{1}, a_{2}, \cdots, a_{n}$ be non-negative real numbers, satisfying $\sum_{i=1}^{n} a_{i}=1$. Find the maximum value of $\left(\sum_{i=1}^{n} i^{2} a_{i}\right) \cdot\left(\sum_{i=1}^{n} \frac{a_{i}}{i}\right)^{2}$.
Solution: Note that, for any $1 \leq i \leq n$, we have $i^{2}+\frac{n(n+1)}{i} \leq n^{2}+n+1$, (this is because the above inequality is equivalent to $\frac{(i-1)(n-i)(n+i+1)}{i} \geq 0$). Therefore, by the AM-GM inequality,
$$
\begin{array}{l}
\left(\sum_{i=1}^{n} i^{2} a_{i}\right) \cdot\left(\sum_{i=1}^{n} \frac{a_{i}}{i}\right)^{2}=\frac{4}{n^{2}(n+1)^{2}}\left(\sum_{i=1}^{n} i^{2} a_{i}\right) \cdot\left(\sum_{i=1}^{n} \frac{n(n+1)}{2 i} a_{i}\right)^{2} \leq \frac{4}{n^{2}(n+1)^{2}}\left[\frac{\sum_{i=1}^{n}\left(i^{2}+\frac{n(n+1)}{i}\right) a_{i}}{3}\right]^{3} \\
\leq \frac{4}{n^{2}(n+1)^{2}}\left(\frac{n^{2}+n+1}{3}\right)^{3}=\frac{4\left(n^{2}+n+1\right)^{3}}{27 n^{2}(n+1)^{2}}
\end{array}
$$

Equality holds if and only if $\sum_{i=1}^{n} i^{2} a_{i}=\sum_{i=1}^{n} \frac{n(n+1)}{2 i} a_{i}, \sum_{i=1}^{n} a_{i}=1$ and $a_{2}=a_{3}=\cdots=a_{n-1}=0$,
i.e., $a_{1}=\frac{2 n+1}{3(n+1)}, a_{n}=\frac{n+2}{3(n+1)}, a_{2}=a_{3}=\cdots=a_{n+}=0$.
In summary, the maximum value of the original expression is $\frac{4\left(n^{2}+n+1\right)^{3}}{27 n^{2}(n+1)^{2}}$.