2. Every positive integer can be expressed as the sum of one or more consecutive positive integers. Try to find, for each positive integer $n$, how many different ways $n$ can be represented as such a sum.
Let $n$ be expressible as the sum of $m$ consecutive positive integers. Let
$$
n=k+(k+1)+\cdots+[k+(m-1)].
$$

Then
$$
\begin{aligned}
n & =m k+\frac{m(m-1)}{2} \\
& =m\left(\frac{2 k+(m-1)}{2}\right).
\end{aligned}
$$
1) If $m$ is odd, then $m-1$ is even, and from (2) we know $m \mid n$, and
$$
\frac{m(m-1)}{2}<n.
$$

Solving for $m$ gives $m<\frac{1+\sqrt{1+8 n}}{2}$.
Conversely, from the above reasoning, for each odd divisor $m$ of $n$ that satisfies (3), there is a corresponding expression (i) for $n$.
2) If $m$ is even, rewrite (2) as
$$
2 n=m(2 k+m-1).
$$

Since $2 k+m-1$ is odd, $m$ is an even divisor of $2 n$, and it must satisfy the condition: if $2^{p_{0}} \| n$, then $2^{p_{0}+1} \| m$. Here, $2^{p_{0}} \| n$ means: $2^{p_{0}} \mid n$, but $2^{p_{0}-1} \nmid n$. Additionally, as in 1), $m$ must also satisfy (3).

Conversely, for each $m$ that satisfies the above conditions, there is a corresponding expression (1) for $n$.

In summary, for each $n \in \mathbb{N}$, let the total number of ways to express $n$ as a sum be $f(n)$, then
$$
f(n)=f_{1}(n)+f_{2}(n).
$$

Here, $f_{1}(n)$ is the number of divisors of $n$ that satisfy inequality (3); $f_{2}(n)$ is the number of even divisors $m$ of $n$ that satisfy (3) and the condition: if $2^{p_{0}} \| n$, then $2^{p_{0}+1} \| m$.