Example 2 Real numbers $a_{1}, a_{2}, \cdots, a_{n}(n \geqslant 3)$ satisfy: $a_{1}+a_{2}+\cdots+a_{n}=0$, and
$$2 a_{k} \leqslant a_{k-1}+a_{k+1}, k=2,3, \cdots, n-1$$

Find the smallest $\lambda(n)$, such that for all $k \in\{1,2, \cdots, n\}$, we have
$$\left|a_{k}\right| \leqslant \lambda(n) \cdot \max \left\{\left|a_{1}\right|,\left|a_{n}\right|\right\} .$$
Solution: First, take $a_{1}=1, a_{2}=-\frac{n+1}{n-1}, a_{k}=\frac{n+1}{n-1}+\frac{2 n(k-2)}{(n-1)(n-2)}, k=3$, $4, \cdots, n$, then it satisfies $a_{1}+a_{2}+\cdots+a_{n}=0$ and $2 a_{k} \leqslant a_{k-1}+a_{k+1}, k=2,3, \cdots$, $n-1$. At this point,
$$\lambda(n) \geqslant \frac{n+1}{n-1}$$

Next, we prove that when $\lambda(n)=\frac{n+1}{n-1}$, for all $k \in\{1,2, \cdots, n\}$, we have
$$\left|a_{k}\right| \leqslant \lambda(n) \cdot \max \left\{\left|a_{1}\right|,\left|a_{n}\right|\right\}.$$

Since $2 a_{k} \leqslant a_{k-1}+a_{k+1}$, it follows that $a_{k+1}-a_{k} \geqslant a_{k}-a_{k-1}$, thus
$$a_{n}-a_{n-1} \geqslant a_{n-1}-a_{n-2} \geqslant \cdots \geqslant a_{2}-a_{1}$$

Therefore, $(k-1)\left(a_{n}-a_{1}\right)=(k-1)\left[\left(a_{n}-a_{n-1}\right)+\left(a_{n-1}-a_{n-2}\right)+\cdots+\left(a_{2}-a_{1}\right)\right]$
$$\begin{array}{l}
\geqslant(n-1)\left[\left(a_{k}-a_{k-1}\right)+\left(a_{k-1}-a_{k-2}\right)+\cdots+\left(a_{2}-a_{1}\right)\right] \\
=(n-1)\left(a_{k}-a_{1}\right)
\end{array}$$

Hence, $\quad a_{k} \leqslant \frac{k-1}{n-1}\left(a_{n}-a_{1}\right)+a_{1}=\frac{1}{n-1}\left[(k-1) a_{n}+(n-k) a_{1}\right]$.
Similarly, for a fixed $k, k \neq 1, n$, when $1 \leqslant j \leqslant k$,
$$a_{j} \leqslant \frac{1}{k-1}\left[(j-1) a_{k}+(k-j) a_{1}\right]$$

When $k \leqslant j \leqslant n$,
$$a_{j} \leqslant \frac{1}{n-k}\left[(j-k) a_{n}+(n-j) a_{k}\right]$$

Therefore, $\sum_{j=1}^{k} a_{j} \leqslant \frac{1}{k-1} \sum_{j=1}^{k}\left[(j-1) a_{k}+(k-j) a_{1}\right]=\frac{k}{2}\left(a_{1}+a_{k}\right)$,
$$\sum_{j=k}^{n} a_{j} \leqslant \frac{1}{n-k} \sum_{j=k}^{n}\left[(j-k) a_{n}+(n-j) a_{k}\right]=\frac{n+1-k}{2}\left(a_{k}+a_{n}\right)$$

Adding these, we get
$$\begin{aligned}
a_{k} & =\sum_{j=1}^{k} a_{j}+\sum_{j=k}^{n} a_{j} \leqslant \frac{k}{2}\left(a_{1}+a_{k}\right)+\frac{n+1-k}{2}\left(a_{k}+a_{n}\right) \\
& =\frac{k}{2} a_{1}+\frac{n+1}{2} a_{k}+\frac{n+1-k}{2} a_{n}
\end{aligned}$$

Thus,
$$a_{k} \geqslant-\frac{1}{n-1}\left[k a_{1}+(n+1-k) a_{n}\right]$$

From (1) and (2), we have
$$\begin{aligned}
\left|a_{k}\right| & \leqslant \max \left\{\frac{1}{n-1}\left|(k-1) a_{n}+(n-k) a_{1}\right|, \frac{1}{n-1}\left|k a_{1}+(n+1-k) a_{n}\right|\right\} \\
& \leqslant \frac{n+1}{n-1} \max \left\{\left|a_{1}\right|,\left|a_{n}\right|\right\}, k=2,3, \cdots, n-1
\end{aligned}$$

In conclusion, $\lambda(n)_{\min }=\frac{n+1}{n-1}$.