Example 9 (1994, 12th American Invitational Mathematics Examination) For a real number $x$, $[x]$ denotes the greatest integer not exceeding $x$. Find the positive integer $n$ such that $\left[\log _{2} 1\right]+\left[\log _{2} 2\right]+\left[\log _{2} 3\right]+\cdots+\left[\log _{2} n\right]=1994$.
Let $S_{n}=\sum_{i=1}^{n}\left[\log _{2} i\right]$.
Notice that, for a non-negative integer $k$, there are $2^{k}$ positive integers $x$ such that $\left[\log _{2} x\right]=k$, i.e., $x=2^{k}, 2^{k}+1, \cdots, 2^{k+1}-1$.
Therefore, for a positive integer $r$, we have
$$
\begin{aligned}
S_{2^{r}-1} & =0+(1+1)+(2+2+2+2)+\cdots+\underbrace{[(r-1)+(r-1)+\cdots+(r-1)]}_{2^{r-1} \uparrow} \\
& =1 \cdot 2+2 \cdot 2^{2}+\cdots+(r-1) \cdot 2^{r-1} \\
& =(r-1) \cdot 2^{r}-\left(2^{r}-2\right) \\
& =(r-2) \cdot 2^{r}+2 .
\end{aligned}
$$

Let $r=8$, then $S_{255}=1538$.
Therefore, if $S_{n}=1994$, then $2^{8}-1<n<2^{9}-1$,
$$
1994=S_{n}=S_{255}+(n-255) \cdot 8=1538+8 n-255 \times 8=8 n-502 .
$$

So $n=312$.