I had to find the complex exponential Fourier series of the following
$f(x):=\begin{cases}-1,\;-L<x<0,\\\;\;1,\quad0<x\le L.\end{cases}$
I'll start by writing the formulas for the series and its coefficient.
$f(x)\sim\sum_{n=-\infty}^{\infty}c_ne^{in\pi x/L}$ where $c_n=\frac{1}{2L}\int_{-L}^{L}f(x)\;e^{-in\pi x/L}$.
Now, solving for the coefficient $c_n$
$c_n=\frac{1}{2L}\int_{-L}^{0}(-1)\;e^{-in\pi x /L}dx+\frac{1}{2L}\int_{0}^{L}(1)\;e^{-in\pi x /L}dx$
$=\frac{1}{2in\pi}\big[1-e^{in\pi}\big]-\frac{1}{2in\pi}\big[e^{-in\pi}-1\big]$
$=\frac{1}{2in\pi}\big[1-e^{in\pi}-e^{-in\pi}+1\big]$
$=\frac{1}{2in\pi}\big[2-cos(n\pi)-isin(n\pi)-cos(n\pi)+isin(n\pi)\big]$
$=\frac{1}{2in\pi}\big[2-2cos(n\pi)\big]$
$=\frac{1}{in\pi}\big[1-cos(n\pi)\big]$
$=\frac{1}{in\pi}\big[1-(-1)^n\big]$
thus $c_n=\begin{cases}0\;if\;n\;even\\\frac{2}{in\pi}=\frac{-2i}{n\pi}\;if\;n\;odd,n\neq0\end{cases}$
$\therefore f(x)\sim\sum_{n\;odd}^{}\frac{-2i}{n\pi}\;e^{in\pi x/L}$
$=\sum_{n=-\infty}^{-1}\frac{-2i}{(2n+1)\pi}\;e^{i(2n+1)\pi x/L}+\sum_{n=1}^{\infty}\frac{-2i}{(2n-1)\pi}\;e^{i(2n-1)\pi x/L}$ QED.
Yes, I have checked analytically that your calculation is all right. Only in the first step in the arguments of $\exp$ you need to put $x$.
So $$f(x)= \sum_{n=-N}^{N} C_n e^{in\pi x/L}, C_n=\frac{(1-(-1)^n)}{in\pi}, C_0=0$$. See the plot of $f(x)$ when $L=\pi$. $N$ should actually to $infty$, however for practical purpose here let us take $N=100$ and draw $f(X)$ here to show that the series represents a step function which you have taken in the starting. When $N\rightarrow \infty$ the oscillations die out.
Also you may write it in more compact way as
$$f(x)=\frac{4}{\pi} \sum_{n=0}^{\infty} \frac{\sin [(2n+1)\pi x/L]}{2n+1}$$