7. For a positive integer $n$, define $S_{2}(n)$ as the sum of the digits in the binary representation of $n$ (for example, $S_{2}(13)=1+1+0+1=3$). Let $T=\sum_{k=1}^{2021}(-1)^{S_{2}(k)} k^{3}$, determine the remainder when $T$ is divided by 2021.
Analysis: Let
$$
f(x)=(1-x)\left(1-x^{2}\right)\left(1-x^{4}\right) \cdots\left(1-x^{1024}\right)=\sum_{k=0}^{2047}(-1)^{s_{2}(k)} x^{k} \text {, }
$$

Notice that $(1-x)^{11}$ is a factor of $f(x)$, so there exists an integer-coefficient polynomial $f^{*}(x)$ such that $f(x)=(1-x)^{11} \cdot f^{*}(x)$, thus
$$
\begin{aligned}
(1-x)^{11} \cdot f^{*}(x) & =(1-x)\left(1-x^{2}\right)\left(1-x^{4}\right) \cdots\left(1-x^{1024}\right) \\
& =\sum_{k=0}^{2047}(-1)^{s_{2}(k)} x^{k},
\end{aligned}
$$

Differentiate both sides of (1) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{10}\left(-11 x \cdot f^{*}(x)+x(1-x) f^{* \prime}(x)\right)=\sum_{k=0}^{2047}(-1)^{s_{2}(k)} k x^{k} \text {, }
$$

Let $f_{1}(x)=-11 x \cdot f^{*}(x)+x(1-x) f^{* *}(x)$, thus
$$
(1-x)^{10} \cdot f_{1}(x)=\sum_{k=0}^{2047}(-1)^{s_{2}(k)} k x^{k},
$$

Similarly, differentiate both sides of (2) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{9} f_{2}(x)=\sum_{k=0}^{2047}(-1)^{S_{2}(k)} k^{2} x^{k},
$$

where $f_{2}(x)=-10 x \cdot f_{1}(x)+x(1-x) f_{1}^{\prime}(x)$. Differentiate both sides of (3) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{8} f_{3}(x)=\sum_{k=0}^{2047}(-1)^{s_{2}(k)} k^{3} x^{k},
$$

where $f_{3}(x)=-9 x \cdot f_{2}(x)+x(1-x) f_{2}^{\prime}(x)$. Taking $x=1$ in (4) yields $\sum_{k=0}^{2047}(-1)^{S_{2}(k)} k^{3}=0$. Note that $2047=2016+31$, using $2016=32 \times 63$ and $S_{2}(63)=6$, we get that when $k \in\{2016,2017, \cdots, 2047\}$, $S_{2}(k)=6+S_{2}(k-2016)$. Let
$$
g(x)=x^{2016} \prod_{i=0}^{4}\left(1-x^{2^{i}}\right)=\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} x^{k},
$$

Notice that $(1-x)^{5}$ is a factor of $g(x)$, so there exists an integer-coefficient polynomial $g^{*}(x)$ such that $g(x)=(1-x)^{5} \cdot g^{*}(x)$, thus
$$
(1-x)^{5} \cdot g^{*}(x)=x^{2016} \prod_{i=0}^{4}\left(1-x^{x^{i}}\right)=\sum_{k=2016}^{2007}(-1)^{s_{2}(k)} x^{k},
$$

Differentiate both sides of (5) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{4}\left(-5 x \cdot g^{*}(x)+x(1-x) g^{* \prime}(x)\right)=\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} k x^{k} \text {, }
$$

Let $g_{1}(x)=-5 x \cdot g^{*}(x)+x(1-x) g^{* \prime}(x)$, thus
$$
(1-x)^{4} g_{1}(x)=\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} k x^{k} \text {, }
$$

Similarly, differentiate both sides of (6) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{3} \cdot g_{2}(x)=\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} k^{2} x^{k},
$$

where $g_{2}(x)=-4 x \cdot g_{1}(x)+x(1-x) g_{1}^{\prime}(x)$. Differentiate both sides of (7) with respect to $x$, then multiply by $x$ to get
$$
(1-x)^{2} \cdot g_{3}(x)=\sum_{k=2016}^{2047}(-1)^{S_{2}(k)} k^{3} x^{k},
$$

where $g_{3}(x)=-3 x \cdot g_{2}(x)+x(1-x) g_{2}{ }^{\prime}(x)$, taking $x=1$ in (8) yields $\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} k^{3}=0$. Therefore, $\sum_{k=0}^{2047}(-1)^{s_{2}(k)} k^{3}=\sum_{k=2016}^{2047}(-1)^{s_{2}(k)} k^{3}=0$, so $\sum_{k=0}^{2015}(-1)^{S_{2}(k)} k^{3}=0$.

Let $l=k-2016$, when $k \in\{2016,2017, \cdots, 2021\}$, $l \in$ $\{0,1, \cdots, 5\}$, at this time, $S_{2}(k)=S_{2}(2016)+S_{2}(l)=6+S_{2}(l)$, $k^{3}=(l+2016)^{3} \equiv(l-5)^{3}(\bmod 2021)$. So,
$$
\begin{aligned}
T & =\sum_{k=2016}^{2021}(-1)^{s_{2}(k)} k^{3}=\sum_{l=0}^{5}(-1)^{6+s_{2}(l)}(l+2016)^{3} \\
& \equiv \sum_{l=0}^{5}(-1)^{s_{2}(l)}(l-5)^{3}(\bmod 2021) \\
& \equiv-125+64+27-8+1(\bmod 2021) \\
& \equiv-41(\bmod 2021) \equiv 1980(\bmod 2021) .
\end{aligned}
$$

In conclusion, the remainder of $T$ when divided by 2021 is 1980.