Example 13 (2002 Shanghai Competition Problem) On a piece of paper, there are $1,2, \cdots, n$ these $n$ positive integers. In the first step, cross out the first 4 numbers 1,2,3,4, and write the sum of the 4 crossed-out numbers 10 at the end of $n$; in the second step, cross out the first 4 numbers $5,6,7,8$ again, and write the sum of the 4 crossed-out numbers 26 at the end; and so on (i.e., in each step, cross out the first 4 numbers and write the sum of the 4 crossed-out numbers at the end).
(1) If only one number is left at the end, what is the necessary and sufficient condition for $n$?
(2) Take $n=2002$, until only one number is left, what is the total sum of all the numbers written (including the original $1,2, \cdots, 2002$)?
(1) With each step, the number of numbers on the paper decreases by 3. If $n$ numbers are reduced to 1 number after $p$ steps, then $n-3p=1$, i.e., $n=3p+1$.
Therefore, the necessary and sufficient condition for $n$ is that $n$ leaves a remainder of 1 when divided by 3.
(2) Suppose there are $4^k$ numbers initially, with their sum being $S$. When these $4^k$ numbers are all crossed out, it takes $4^{k-1}$ steps, and $4^{k-1}$ numbers remain on the paper, and the sum of these $4^{k-1}$ numbers equals the original sum $S$ of the $4^k$ numbers. Therefore, when only 1 number remains, the total sum of the numbers written is $(k+1)S$.
$2002=1024+978=4^5+978$. Initially, 2002 numbers, after $\frac{978}{3}=326$ steps, leave $4^5$ numbers. The numbers crossed out are 1, 2, 3, ..., 1304 (note that $1304=4 \times 326$), and the sum of the $4^5$ numbers left on the paper is $1+2+\cdots+2002$. Therefore, when only 1 number remains, the total sum of the numbers written is $(1+2+\cdots+1304)+6(1+2+3+\cdots+2002)=12880878$.