2. For each positive integer $n$, find the number of permutations $\left(a_{1}, a_{2}, \cdots, a_{n}\right)$ of the set $\{1,2, \cdots, n\}$, where $a_{1}, a_{2}, \cdots, a_{n}$ satisfy that for $k=1,2, \cdots, n, 2\left(a_{1}+a_{2}+\cdots\right.$ $\left.+a_{k}\right)$ is divisible by $k$.
2. For each positive integer $n$, let $F_{n}$ be the number of permutations of the set $\{1,2, \cdots, n\}$ that satisfy the condition, and call these permutations "good". Then for $n=1,2,3$, every permutation is good. Therefore, $F_{1}=1, F_{2}=2, F_{3}=6$.

For $n>3$, consider a good permutation $\left(a_{1}, a_{2}, \cdots, a_{n}\right)$ of $\{1,2, \cdots, n\}$, then $n-1$ is
\[
\begin{array}{l}
2\left(a_{1}+a_{2}+\cdots+a_{n-1}\right) \\
=2\left[(1+2+\cdots+n)-a_{n}\right] \\
=n(n+1)-2 a_{n} \\
=(n+2)(n-1)+\left(2-2 a_{n}\right)
\end{array}
\]

a divisor. Therefore, $2 a_{n}-2$ can be divided by $n-1$. Thus, $2 a_{n}-2$ equals 0 or $n-1$ or $2 n-2$, i.e.,
\[
a_{n}=1 \text { or } a_{n}=\frac{n+1}{2} \text { or } a_{n}=n \text {. }
\]

Assume $a_{n}=\frac{n+1}{2}$. Since the permutation is good, we can take $k=n-2$, so $n-2$ is
\[
\begin{aligned}
2 & \left(a_{1}+a_{2}+\cdots+a_{n-2}\right) \\
= & 2\left[(1+2+\cdots+n)-a_{n}-a_{n-1}\right] \\
& =n(n+1)-(n+1)-2 a_{n-1} \\
= & (n+2)(n-2)+\left(3-2 a_{n-1}\right)
\end{aligned}
\]

a divisor. Therefore, $2 a_{n-1}-3$ can be divided by $n-2$. Thus, $2 a_{n-1}-3$ equals 0 or $n-2$ or $2 n-4$.

Since $2 a_{n-1}-3$ is odd, it cannot equal 0 and $2 n-4$. Thus, $2 a_{n-1}-3=n-2$, i.e., $a_{n-1}=\frac{n+1}{2}=a_{n}$, which is a contradiction.

Assume $a_{n}=n$. Then $\left(a_{1}, a_{2}, \cdots, a_{n-1}\right)$ is a good permutation of $\{1,2, \cdots, n-1\}$. Therefore, there are $F_{n-1}$ good permutations. Adding $n$ to each of these good permutations as the last term (i.e., the $n$-th term), we get a good permutation of $\{1,2, \cdots, n\}$.

Assume $a_{n}=1$. Then $\left(a_{1}-1, a_{2}-1, \cdots, a_{n-1}-1\right)$ is a permutation of $\{1,2, \cdots, n-1\}$, and it is a good permutation, because for any positive integer $k \leqslant n-1$,
\[
\begin{array}{l}
2\left[\left(a_{1}-1\right)+\left(a_{2}-1\right)+\cdots+\left(a_{k}-1\right)\right] \\
=2\left(a_{1}+a_{2}+\cdots+a_{k}\right)-2 k
\end{array}
\]

can be divided by $k$. Therefore, for any good permutation $\left(b_{1}, b_{2}, \cdots, b_{n-1}\right)$ of $\{1,2, \cdots, n-1\}$, adding 1 to this permutation as the last term, and adding 1 to each of the first $n-1$ terms, we get the permutation $\left(b_{1}+1, b_{2}+1, \cdots, b_{n-1}+1,1\right)$, which is a good permutation of $\{1,2, \cdots, n\}$.

Thus, $\{1,2, \cdots, n\}$ has $F_{n-1}$ good permutations with the last term being $n$, and also has $F_{n-1}$ good permutations with the last term being 1. Therefore, $F_{n}=2 F_{n-1}$.
Given $F_{3}=6$, we know that for $n \geqslant 4$, $F_{n}=3 \times 2^{n-2}$.