Delta function and $\sum_{t}\exp\{ i k t\} $ I am interested in evaluating the following, which appears in an integrand,
$$
\sum_{t=0}^{\infty}e^{ikt}
$$
where $k$ is real. Using the following relation
$$
\sum_{t=-\infty}^{\infty}e^{ikt} = 2\pi\delta(k),
$$
the real part of it is
\begin{eqnarray}
\Re\left[\sum_{t=0}^{\infty}e^{ikt}\right]&=&\frac{1}{2}+\frac{1}{2}\Re\left[\sum_{t=-\infty}^{\infty}e^{ik}\right]\\&=&\frac{1}{2}+\pi\delta(k).
\end{eqnarray}
Note the addition of $\frac{1}{2}$ term! This $\frac{1}{2}$ term does not agree with the following derivation using $\epsilon$ trick!
\begin{eqnarray}
\lim_{\epsilon\rightarrow0_{+}}\lim_{T\rightarrow\infty}\sum_{t=0}^{T}e^{ikt}e^{-\epsilon t}&=&\lim_{\epsilon\rightarrow0_{+}}\lim_{T\rightarrow\infty}\frac{e^{\epsilon}-e^{ik\left(T+1\right)}e^{-\epsilon T}}{e^{\epsilon}-e^{ik}}\\
&=&\lim_{\epsilon\rightarrow0_{+}}\frac{1}{e^{\epsilon}-e^{ik}}
\end{eqnarray}
which becomes, when $k \rightarrow 0$,
\begin{eqnarray}
\lim_{k\rightarrow0,}\lim_{\epsilon\rightarrow0_{+}}\frac{1}{e^{\epsilon}-e^{ik}}&=&\lim_{k\rightarrow0,}\lim_{\epsilon\rightarrow0_{+}}\frac{1}{\epsilon-ik}\\
&=&\lim_{k\rightarrow0}\lim_{\epsilon\rightarrow0_{+}}\frac{i}{k+i\epsilon}\\&=&\lim_{k\rightarrow0}\left[\pi\delta\left(k\right)+i\mathcal{P}\frac{1}{k}\right]
\end{eqnarray}
where Sokhotsky's formula is used.
Now when $k\nrightarrow0$,
$$
\lim_{\epsilon\rightarrow0_{+}}\frac{1}{e^{\epsilon}-e^{ik}}=\frac{1}{1-e^{ik}}
$$
Therefore, for all $k$,
$$
\sum_{t=0}^{\infty}e^{ikt}=\pi\delta\left(k\right)+\mathcal{P}\frac{1}{1-e^{ik}}
$$
Note that the real part of it does not have $\frac{1}{2}$ addition term, instead has $\Re\mathcal{P}\frac{1}{1-e^{ik}}$.
What am I doing wrong?

Building on Svyatoslav's answer which in turn supported by vitamin d, the conclusion is the following:
$$
\sum_{t=0}^{\infty}e^{ikt} = \frac{1}{2} + \pi \delta(k) + \frac{i}{2} \mathcal{P} \cot (k/2)
$$

If we do formal calculations (without the proof of validity) we get
$S(k)=\sum_{t=0}^{\infty}e^{ikt}=1+\sum_{t=1}^{\infty}e^{ikt}+\sum_{t=-1}^{-\infty}e^{ikt}-\sum_{t=-1}^{-\infty}e^{ikt}=\sum_{t=-\infty}^{+\infty}e^{ikt}+1-\sum_{t=0}^{\infty}e^{-ikt}$
$\Rightarrow$ $S(k)+S^*(k)=1+2\pi\delta(k)$
On the other hand, if we use $\epsilon$-regularization
$$S(k,\epsilon)=\sum_{t=0}^{\infty}e^{ikt-\epsilon{t}}=\frac{e^{\epsilon}}{e^{\epsilon}-e^{ik}}=\frac{e^{\epsilon}(e^{\epsilon}-e^{-ik})}{1+e^{2\epsilon}-e^{\epsilon}(e^{ik}+e^{-ik})}=\frac{e^{\epsilon}-\cos{k}+i\sin{k}}{e^{\epsilon}+e^{-\epsilon}-(e^{ik}+e^{-ik})}$$
$$S(k,\epsilon)=\frac{1}{2}+\frac{\sinh\epsilon+i\sin{k}}{2(\cosh\epsilon-\cos{k})}=\frac{1}{2}+\frac{\sinh\epsilon}{2(\cosh\epsilon-\cos{k})}+\frac{i\sin{k}}{2(\cosh\epsilon-\cos{k})}$$
$S(k,\epsilon)\to\frac{1}{2}+\frac{\epsilon}{\epsilon^2+k^2}=\frac{1}{2}+\pi\delta(k)$,  $k<<\epsilon$, $\epsilon\to0$
$S(k,\epsilon)\to\frac{1}{2}+\frac{i}{2}\frac{\sin{k}}{1-\cos{k}}=\frac{1}{2}+\frac{i}{2}\cot\frac{k}{2}$, $k>>\epsilon$, $\epsilon\to0$
$S(k,\epsilon)+S^*(k,\epsilon)\to1+2\pi\delta(k)$ for all $k$
