Example 3 Let the sum of non-zero real numbers $x_{1}, x_{2}, \cdots, x_{n}$ be 0. Try to find the minimum value of $\left(\sum_{i=1}^{n} x_{i}^{2}\right)\left(\sum_{i=1}^{n} \frac{1}{x_{i}^{2}}\right)$.
Given, we can set $x_{1}, x_{2}, \cdots, x_{k}>0$, $x_{k+1}, \cdots, x_{n} \leq 0$.

By the Cauchy-Schwarz inequality, we have
$$
\begin{array}{l}
\sum_{i=1}^{k} x_{i}^{2} \geqslant \frac{1}{k}\left(\sum_{i=1}^{k} x_{i}\right)^{2}=\frac{S^{2}}{k}, \\
\sum_{i=k+1}^{n} x_{i}^{2} \geqslant \frac{1}{n-k}\left(\sum_{i=k+1}^{n} x_{i}\right)^{2}=\frac{S^{2}}{n-k} .
\end{array}
$$

By the Power Mean Inequality, we have
$$
\begin{array}{l}
\sum_{i=1}^{k} \frac{1}{x_{i}^{2}} \geqslant \frac{k^{3}}{\left(\sum_{i=1}^{k} x_{i}\right)^{2}}=\frac{k^{3}}{S^{2}}, \\
\sum_{i=k+1}^{n} \frac{1}{2} \geqslant \frac{(n-k)^{3}}{\left(\sum_{i=k+1}^{n} x_{i}\right)^{2}}=\frac{(n-k)^{3}}{S^{2}} . \\
\text { Then }\left(\sum_{i=1}^{n} x_{i}^{2}\right)\left(\sum_{i=1}^{n} \frac{1}{x_{i}^{2}}\right) \\
\geqslant\left(\frac{S^{2}}{k}+\frac{S^{2}}{n-k}\right)\left(\frac{k^{3}}{S^{2}}+\frac{(n-k)^{3}}{S^{2}}\right) \\
=\frac{n^{2}\left(n^{2}-3 n k+3 k^{2}\right)}{k(n-k)} \\
=n^{2}\left(\frac{n-k}{k}+\frac{k}{n-k}-1\right) . \\
\text { When } x_{1}=x_{2}=\cdots=x_{k}=\frac{S}{k}, x_{k+1}=\cdots=x_{n}=\frac{-S}{n-k}
\end{array}
$$

the equality holds in all the above inequalities.
It is easy to see that if $n$ is even, then when $k=\frac{n}{2}$, $\frac{n-k}{k}+\frac{k}{n-k}$ achieves its minimum value 2;

if $n$ is odd, then when $k=\frac{n \pm 1}{2}$, $\frac{n-k}{k}+\frac{k}{n-k}$ achieves its minimum value $2+\frac{4}{n^{2}-1}$.
Therefore, the minimum value sought is
$\left\{\begin{array}{ll}n^{2}, & n \text { is even; } \\ \frac{n^{2}\left(n^{2}+3\right)}{n^{2}-1}, & n \text { is odd. }\end{array}\right.$