13. Let $n$ be a given positive integer, and $a_{1}, a_{2}, \cdots, a_{n}$ be a sequence of real numbers such that for each $m \leqslant n$, we have $\left|\sum_{k=1}^{m} \frac{a_{k}}{k}\right| \leqslant 1$.

Find the maximum value of $\left|\sum_{k=1}^{n} a_{k}\right|$.
$$
\begin{array}{l}
\left|\sum_{k=1}^{n} a_{k}\right|=\left|a_{1}+a_{2}+\cdots+a_{n}\right| \\
=\left|n\left(a_{1}+\frac{a_{2}}{2}+\cdots+\frac{a_{n}}{n}\right)-\left(a_{1}+\frac{a_{2}}{2}+\cdots+\frac{a_{n-1}}{n-1}\right)-\cdots-\left(a_{1}+\frac{a_{2}}{2}\right)-a_{1}\right| \\
\leqslant n\left|a_{1}+\frac{a_{2}}{2}+\cdots+\frac{a_{n}}{n}\right|+\left|a_{1}+\frac{a_{2}}{2}+\cdots+\frac{a_{n-1}}{n-1}\right|+\cdots+\left|a_{1}+\frac{a_{2}}{2}\right|+\left|a_{1}\right| \\
\leqslant n+n-1=2 n-1, \text { when } a_{1}=1, a_{n}=(-1)^{n-1} \cdot 2 n(n \geqslant 2) \text { equality holds. }
\end{array}
$$

Therefore, the maximum value of $\left|\sum_{k=1}^{n} a_{k}\right|$ is $2 n-1$.