Evaluating sum $\sum_{m=0}^{\infty}\frac{(2-\delta_m^0)(-1)^m \lambda_0}{a(\lambda_0^2 -(\frac{m\pi}{a}))}\cos(m\pi x/a)$ How Can I evaluate the following sum$$\sum_{m=0}^{\infty}\frac{2-\delta_m^0}{a}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}\cos\left(\frac{m\pi x}{a}\right)=\frac{\cos(\lambda_0 x)}{\sin(\lambda_0 a)}$$
I have read this in a research paper 

I have tried evaluating the sum using finite cosine transform 
We have $$\frac{2}{a}\frac{1}{\lambda_0}+\frac{2}{a}\sum_{m=0}^{\infty}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}\cos\left(\frac{m\pi x}{a}\right)=f(x)$$
So
$$\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}=\int_{0}^{a} f(x)\cos\left(\frac{m\pi x}{a}\right) dx $$
How to find $f(x)$ ?
And Is there any other way to evaluate the sum ?
Thanks In advance.
 A: Focusing on the main task of the problem in the OP I shall calculate the sum starting at $m=1$ and dropping the overall factor $\lambda$, i.e. the expression
$$f(x) = \frac{2 }{a} \sum _{m=1}^{\infty } \frac{(-1)^m \cos \left(\frac{\pi  m x}{a}\right)}{\lambda ^2-\frac{\pi  m}{a}}\tag{1}$$
Assuming $\lambda ^2 \lt \frac{\pi}{a}$ we write 
$$\frac{1}{\lambda ^2-\frac{\pi  m}{a}} = - \int_{0}^{\infty} e^{-t (\frac{\pi  m}{a}-\lambda ^2)}\, dt\tag{2}$$
and 
$$\cos(\frac{m \pi x}{a}) = \Re \exp(i \frac{m \pi x}{a})$$
Substituting this into $(1)$ the /geometric) sum can be done under the integral:
$$\sum _{m=1}^{\infty } (-1)^m \exp \left(\frac{i \pi  m x}{a}\right) \exp \left(-t \left(\frac{\pi  m}{a}-\lambda ^2\right)\right)\\=
-\frac{e^{t \left(-\left(\frac{\pi }{a}-\lambda ^2\right)\right)+\frac{\pi  t}{a}+\frac{i \pi  x}{a}}}{e^{\frac{\pi  t}{a}}+e^{\frac{i \pi  x}{a}}}$$
Integrating the negative this over $t$ according to $(2)$ and applying the missing factor gives
$$-\frac{2}{\pi} 
\left(-e^{\frac{i \pi  x}{a}}\right)^{\frac{a \lambda ^2}{\pi }} B(-e^{\frac{i \pi  x}{a}},1-\frac{a \lambda ^2}{\pi },0)\tag{3}$$
Here $B$ is the incomplete Beta function defined by
$$B(z,a,b) = \int_{0}^{z} t^{a-1} (1-t)^{b-1}$$
We now have to take the real part.
Selecting the simplified case $\lambda \to 0$ expression $(3)$ reduces to
$$\frac{2}{\pi} \log \left(1+e^{\frac{i \pi  x}{a}}\right)$$
The real part and hence the sum is
$$f(\lambda\to 0)=\frac{1}{\pi} \log \left(4 \cos \left(\frac{\pi  x}{2 a}\right)^2\right)\tag{4}$$
The case $0 \lt \lambda ^2 (\lt \frac{\pi}{a})$ can be extracted from $(3)$ as well. It will be left as an exercise in complex arithmetic to the reader.
For any $\lambda \ne \sqrt{\frac{\pi m}{a}}$ the sum can be expressed by the Hurwitz-Lerch transcendent as follows
$$f= \frac{1}{\pi} 
\left(
e^{\frac{i \pi  x}{a}} \Phi \left(-e^{\frac{i \pi  x}{a}},1,1-\frac{a \lambda ^2}{\pi }\right)
+e^{-\frac{i \pi  x}{a}} \Phi \left(-e^{-\frac{i \pi  x}{a}},1,1-\frac{a \lambda ^2}{\pi }\right)
\right)\tag{5}$$
$\Phi $ is defined as
$$\Phi(z,s,a) = \sum_{k=0}^{\infty} z^k (k+a)^{-s} $$
A: Too long for the comment.
The issue sum
$$S_1 = \sum_{m=0}^{\infty}\frac{2-\delta_{m0}}{a}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}\cos\left(\frac{m\pi x}{a}\right),\tag1$$
where $\delta_{ij}$ is the Kronekker symbol,
can be considered as the particular case of $S_k$, where
$$S_k = \frac{1}{a}\frac{1}{\lambda_0} + \frac{2}{a}\sum_{m=1}^{\infty}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})^k}\cos\left(\frac{m\pi x}{a}\right).\tag2$$
Using known exponential Fourier series for cosine function

$$\cos(bz) =
 \dfrac{2b\sin(b\pi)}\pi\left(\dfrac1{2b^2}-\sum\limits_{m=1}^\infty
 \dfrac{(-1)^m\cos(mz)}{m^2-b^2}\right)\tag3$$

with the values 
$$b=\dfrac{\lambda_0a}\pi,\quad z = \dfrac{\pi x}a,$$
one can get
$$\dfrac 1\pi\dfrac{\cos(\lambda_0x)}{\sin(\lambda_0a)} 
= \dfrac1{a\lambda_0} + \dfrac{2\lambda_0a}{\pi^2} \sum\limits_{m=1}^\infty \dfrac{(-1)^m\cos\left(\dfrac{m\pi x}{a}\right)}{\dfrac{\lambda_0^2a^2}{\pi^2}-m^2}=S_2.$$
