Example 15 Given a positive integer $n$ and a positive number $M$, for all arithmetic sequences $a_{1}, a_{2}, a_{3}, \cdots$ satisfying the condition $a_{1}^{2}+$ $a_{n+1}^{2} \leqslant M$, find the maximum value of $S=a_{n+1}+a_{n+2}+\cdots+a_{2 n+1}$.
According to the problem, we can obtain \( S = \frac{(n+1)\left(a_{n+1} + a_{2n+1}\right)}{2} \),
\[
\because a_{1} + a_{2n+1} = 2a_{n+1},
\]

Substituting into the above equation, we get \( S = \frac{(n+1)\left(3a_{n+1} - a_{1}\right)}{2} \).
By the Cauchy-Schwarz inequality, we have
\[
S \leqslant \frac{(n+1)}{2} \sqrt{3^2 + (-1)^2} \cdot \sqrt{a_{n+1}^2 + a_{1}^2} \leqslant \frac{(n+1)}{2} \sqrt{10M},
\]

Equality holds if and only if \( 3a_{n+1} - a_{1} > 0 \) and \( a_{1}^2 + a_{n+1}^2 = M \) and \( \frac{a_{n+1}}{3} = \frac{a_{1}}{-1} \), from which we get \( a_{1} = -\frac{\sqrt{10M}}{10}, a_{n+1} = \frac{3\sqrt{10M}}{10} \), at this point \( S \) reaches its maximum value of \( \frac{(n+1)}{2} \sqrt{10M} \).