I have a function on $[-\pi, \pi)$ defined as:
$$ f(x) = \begin{cases} -1 & \mbox{if} \;x \in [-\pi,0) \\ 1 & \mbox{if} \;x \in [0,\pi) \\ \end{cases} $$
And I have to write it in the form $f(x) = \sum_{k=-\infty}^\infty c_k e^{ikx}$, where I have to find the values of $c_k$.
My first thought was to split it up into $\sum c_k(\cos kx + i \sin kx)$, but I don't know where to go from there. If I had to find the Fourier series for this function, i.e. finding the values of $a_n$ and $b_n$ in $\sum a_k \cos kx + b_k \sin kx$, then I'd see that the function was odd and throw away all of the cos terms by saying $a_k = 0$. But I can't do that when both the cos and sin bits have the same coefficient $c_k$, so I'm a bit stuck.
The exponential Fourier coefficients are given by: $$c_k=\frac1{2\pi}\int_{-\pi}^{\pi}f(t)\mathrm{e}^{-ikt}\,\mathrm{d}t.$$ With this we get: $$c_k=\begin{cases}i\dfrac{(-1)^k-1}{k\pi}&\text{if $k\neq0$}\\0&\text{if $k=0$}.\end{cases}$$ Since $f$ is piecewise of class $C^1$ we obtain, by Dirichlet Theorem, that $$\forall x\in[-\pi,\pi),\ f^{\mathrm{reg}}(x)=\sum_{k\in\mathbb{Z}}c_k\mathrm{e}^{ikx},$$ where $f^{\mathrm{reg}}$ is the regular part of $f$: $$\forall x\in[-\pi,\pi),\ f^{\mathrm{reg}}(x)=\begin{cases}0&\text{if $x\in\{-\pi,0\}$}\\-1&\text{if $x\in(-\pi,0)$}\\1&\text{if $x\in(0,\pi)$.}\end{cases}$$
Another method using what you tried: indeed, $f$ is essentially odd, hence all the coefficients $a_k$ (using your notation) are nil. We only need to determine the $b_k$: for $k\in\mathbb{N}^*$, $$b_k=\frac1\pi\int_{-\pi}^{\pi}f(t)\sin(kt)\,\mathrm{d}t=\frac2\pi\int_0^{\pi}\sin(kt)\,\mathrm{d}t=-2\frac{(-1)^k-1}{k\pi}.$$ By Dirichlet Theorem, we have: $$\forall x\in[-\pi,\pi),\ f^{\mathrm{reg}}(x)=\sum_{n=1}^{+\infty}b_n\sin(nx).$$ Now, using the fact that: $$\sin(x)=\frac{\mathrm{e}^{ix}-\mathrm{e}^{-ix}}{2i},$$ the general term of our Fourier series reads as: $$b_n\sin(nx)=i\frac{(-1)^n-1}{n\pi}\mathrm{e}^{inx}+i\frac{(-1)^{-n}-1}{-n\pi}\mathrm{e}^{-inx}.$$ We're hence tempted to set: $$\forall n\in\mathbb{Z},\ c_n=\begin{cases}0&\text{if $n=0$}\\i\dfrac{(-1)^n-1}{n\pi}&\text{if $n\neq0$}\end{cases}$$ and we hence obtain: $$\forall x\in[-\pi,\pi),\ f^{\mathrm{reg}}(x)=\sum_{n\in\mathbb{Z}}c_n\mathrm{e}^{inx}.$$
Notes.