Example 16 For a positive integer $n$, define $S_{n}$ as the minimum value of the sum
$$
\sum_{k=1}^{n} \sqrt{(2 k-1)^{2}+a_{k}^{2}}
$$
where $a_{1}, a_{2}, \cdots, a_{n}$ are positive real numbers whose sum is 17. There is a unique positive integer $n$ for which $S_{n}$ is also an integer. Find this $n$.
Solve as shown in Figure 2-6, construct $A B_{1}=1, C_{1} B_{2}=3$, $\cdots, C_{n-1} B_{n}=2 n-1, B_{1} C_{1}=a_{1}, B_{2} C_{2}=a_{2}, \cdots$, $B_{n-1} C_{n-1}=a_{n-1}, B_{n} C=a_{n}$. Then $A B=\sum_{k=1}^{n}(2 k-1) =n^{2}, B C=17$.
Since
$$
A C_{1}+C_{1} C_{2}+\cdots+C_{n-1} C \geqslant A C,
$$

we have $\sum_{k=1}^{n} \sqrt{(2 k-1)^{2}+a_{k}^{2}} \geqslant \sqrt{n^{4}+17^{2}}$.
Thus $S_{n}=\sqrt{n^{4}+17^{2}}$ (since the above inequality can achieve equality).
By the problem's condition
$$
n^{4}+17^{2}=k^{2}, k \in \mathbf{N}^{*} \text {. }
$$

Therefore,
$$
\left(k-n^{2}\right)\left(k+n^{2}\right)=289 \text {. }
$$

Since $k-n^{2}$ and $k+n^{2}$ are both positive integers, and $k+n^{2}>k-n^{2}$, it must be that
$$
k-n^{2}=1, k+n^{2}=289 \text {. }
$$

Hence $n^{2}=144, n=12$. When $n=12$, $S_{12}=145$.