Example 4 Find the smallest positive integer $n$, such that for any sequence of $n$ positive integers $a_{1}, a_{2}, \cdots, a_{n}$ satisfying $\sum_{i=1}^{n} a_{i}=2007$, there must be a sum of some consecutive terms equal to 30.
(Fourth China Southeast Mathematical Olympiad)
First, construct an integer sequence $a_{1}, a_{2}, \cdots, a_{1017}$ with 1017 terms, such that no consecutive terms sum to 30. For this, take
$$
a_{1}=a_{2}=\cdots=a_{29}=1, a_{30}=31,
$$

and $a_{30 m+i}=a_{i}(i=1,2, \cdots, 30, m \in \mathbf{N})$.
Thus, $\left\{a_{k}\right\}$ is:
$$
\begin{array}{l}
1,1, \cdots, 1,31 ; 1,1, \cdots, 1,31 ; \cdots ; \\
1,1, \cdots, 1,31 ; 1,1, \cdots, 1
\end{array}
$$
(There are 34 segments, the first 33 segments each have 30 terms, and the last segment has 27 terms, totaling 1017 terms).

Second, when the number of terms is less than 1017, it is sufficient to merge some consecutive numbers in certain segments into larger numbers.

For any positive integer sequence $a_{1}, a_{2}, \cdots, a_{1018}$ with 1018 terms that satisfies the condition $\sum_{i=1}^{1018} a_{i}=2007$, we will prove that there must be consecutive terms whose sum equals 30.
In fact, let $S_{k}=\sum_{i=1}^{k} a_{i}$. Then
$$
1 \leqslant S_{1}<S_{2}<\cdots<S_{1018}=2007 \text {. }
$$

Now consider the grouping of elements in the set $\{1,2, \cdots, 2007\}$: $\square$
$$
\begin{array}{c}
(60 k+i, 60 k+30+i), \\
(k=0,1, \cdots, 32 ; i=1,2, \cdots, 30), \\
1981,1982, \cdots, 2007 .
\end{array}
$$

There are $33 \times 30=990$ pairs and 27 numbers not in pairs. From these, any 1018 numbers taken as the values of $S_{k}$ must include two numbers from the same pair, say $\left(S_{k}, S_{k+m}\right)$. Then $S_{k+m}-S_{k}=30$, meaning that in the sequence,
$$
a_{k+1}+a_{k+2}+\cdots+a_{k+m}=30 .
$$

Therefore, the minimum value of $n$ is 1018.