Let $\pi_{i}$ be the probability that unit $U_{i}$ is included in sample of size $n$ by a without replacement sampling procedure.
Now, define a random variable $t_{i}$, for $i=1,2,\cdots N$, by
\begin{equation}
t_{i}=\begin{cases}
1, & U_{i}\in s\\
0, & \text{ otherwise. }
\end{cases}
\end{equation}
Since a without replacement sampling procedure gives rise to $n$ distinct units, it is clear that
\begin{equation}
\sum_{i=1}^{N}t_{i}=n, \text{ and }
\end{equation}
\begin{equation}
E(t_{i})=\pi_{i}.
\end{equation}
A general linear function of the sample values can be written as
\begin{eqnarray}
T &=& \sum_{i=1}^{n}c_{i}y_{i},\qquad \text{ or }\\
T &=& \sum_{i=1}^{N}t_{i}c_{i}y_{i}
\end{eqnarray}
where $c_{i}$ is a constant attached to the unit $U_{i}$ whenever it is selected into the sample and
Considering expectation of $T$, we get,
\begin{equation}
E(T)= \sum_{i=1}^{N}\pi_{i}c_{i}y_{i}
\end{equation}
For $T$ to be an unbiased estimator of the population total $\sum_{i=1}^{N}Y_{i}$, the constant $c_{i}$ should equal to $1/\pi_{i}$. Thus an unbiased estimator for the population total, as suggested by Horvitz-Thompson, is given by,
\begin{eqnarray}
\hat{Y}_{HT} &=& \sum_{i=1}^{N}t_{i}\left(\dfrac{Y_{i}}{\pi_{i}}\right)\qquad \text{ or }\\
\hat{Y}_{HT} &=& \sum_{i=1}^{n}\dfrac{y_{i}}{\pi_{i}}
\end{eqnarray}