Example 7 Given a positive integer $n$ and a positive number $M$, for all arithmetic sequences $a_{1}, a_{2}, \cdots, a_{n}$ satisfying the condition $a_{1}^{2}+a_{n+1}^{2} \leqslant M$, try to find the maximum value of $S=a_{n+1}+a_{n+2}+\cdots+a_{2 n+1}$.
Analysis This problem is related to the conditions of an arithmetic sequence, and the methods for solving the extremum are flexible and varied. Different interpretations of the conditions will lead to different solutions.

Solution (Method One: Let the common difference be $d$, $a_{n+1}=a$, then $S=a_{n+1}+a_{n+2}+\cdots+a_{2 n+1}=$ $(n+1) a+\frac{n(n+1)}{2} d$, so $a+\frac{n d}{2}=\frac{S}{n+1}$. By the Cauchy-Schwarz inequality, $\left(\frac{S}{n+1}\right)^{2}=$ $\left(a+\frac{n d}{2}\right)^{2}=\left(\frac{1}{2} a-\frac{n d}{2}+\frac{3}{2} a\right)^{2} \leqslant\left[\left(\frac{1}{2}\right)^{2}+\left(\frac{3}{2}\right)^{2}\right]\left[(a-n d)^{2}+a^{2}\right]=$ $\frac{10}{4}\left(a_{1}^{2}+a_{n+1}^{2}\right) \leqslant \frac{10}{4} M$, thus $|S| \leqslant \frac{\sqrt{10}}{2}(n+1) \cdot \sqrt{M}$, and when $a=\frac{3}{\sqrt{10}} \cdot \sqrt{M}$, $d=\frac{4}{\sqrt{10}} \cdot \frac{\sqrt{M}}{n}$, $S=(n+1)\left(\frac{3}{\sqrt{10}} \cdot \sqrt{M}+\frac{n}{2} \cdot \frac{4}{\sqrt{10}} \cdot \frac{\sqrt{M}}{n}\right)=(n+1)$. $\frac{5}{\sqrt{10}} \sqrt{M}=\frac{\sqrt{10}}{2}(n+1) \sqrt{M}$. Since at this point $4 a=3 n d$, hence $a_{1}^{2}+a_{n+1}^{2}=\frac{4}{10}\left(\frac{S}{n+1}\right)^{2}=$
M. Therefore, the maximum value of $S=a_{n+1}+a_{n+2}+\cdots+a_{2 n+1}$ is $\frac{\sqrt{10}}{2}(n+1) \sqrt{M}$.
(Method Two): Trigonometric method, by the condition $a_{1}^{2}+a_{n+1}^{2} \leqslant M$, we can let $a_{1}=r \cos \theta, a_{n+1}=$ $r \sin \theta$, where $0 \leqslant r \leqslant M$. Hence $S=a_{n+1}+a_{n+2}+\cdots+a_{2 n+1}=\frac{\left(a_{n+1}+a_{2 n+1}\right)(n+1)}{2}$ $=\frac{n+1}{2}\left(3 a_{n+1}-a_{1}\right)=\frac{n+1}{2} r(3 \sin \theta-\cos \theta)=\frac{\sqrt{10}}{2}(n+1) r \sin (\theta-\varphi)$, where $\cos \varphi=\frac{3}{\sqrt{10}}, \sin \varphi=\frac{1}{\sqrt{10}}$. Therefore, when $\sin (\theta-\varphi)=1, r=\sqrt{M}$, the maximum value of $S=a_{n+1}+$ $a_{n+2}+\cdots+a_{2 n+1}$ is $\frac{\sqrt{10}}{2}(n+1) \sqrt{M}$.