Given this formula:
$$\sum\limits_{n=0}^\infty a_n \cos(n \pi x / d) = \delta(x-x_0)$$
Where $0 \leq x \leq d$. How can one calculate the coeffciients $a_n$?
I googled and searched all kinds of books, but could not find a representation of the Dirac delta to solve this problem.

If you want a Fourier series then you need a repetition of the $\delta$ distribution at the right.
The 'Dirac comb' is defined by : $$\Delta_T(t):=\sum_{k=-\infty}^\infty \delta(t-kT)$$ with $$\Delta_T(t)=\frac 1T\sum_{n=-\infty}^\infty e^{i2\pi nt/T}=\frac 1T+\frac 2T\sum_{n=1}^\infty \cos\left(\frac{2\pi nt}T\right)$$
Replace $\frac T2$ by $d\ $ and $\ t$ by $x-x_0$ to get an interesting result