Express a wave as a sum of cosine
The Fourier transform converts signals into coefficients of cosines and sines. This is why the coefficients are complex. Simply adding up those two coefficients won't give you sufficient information about the phase (someone can correct me on this statement, but I believe it's true). In other words, for signal of length N you're trying to find coefficients $a_k$ and $b_k$ such that

$$ x[n] = \sum_{k=0}^{N/2} a_k \cos(\omega k)+\sum_{k=0}^{N/2} b_k \sin(\omega k)$$

I would suggest using Discrete Cosine Transform (DCT) instead. It literally breaks you signal up into a sum of cosines, it gives you back all real coefficients and it takes care of the phase problem completely.

If you must use Fourier Transform, you should realize that

$$e^{i \omega t} = \cos (\omega t) + i \sin(\omega t)$$

This tells us that we can recreate the even-symmetric component (cosine) from real coefficients of the Fourier Transform, and odd-symmetric component (sine) from imaginary coefficients of the Fourier Transform.

The formula then befomes:

For a given $k$,

$$a_k \cos\left( \frac{2 \pi kn}{N} \right) = \frac{1}{N}\left( \Re (X[k]) e^{ \tfrac{i 2 \pi kn}{N}} + \Re (X[N-k]) e^{ \tfrac{i 2 \pi (N-k)n}{N} } \right), $$

$$b_k \sin\left( \frac{2 \pi kn}{N} \right) = \frac{1}{Ni}\left( \Im (X[k]) e^{ \tfrac{i 2 \pi kn}{N}} + \Im (X[N-k]) e^{ \tfrac{i 2 \pi (N-k)n}{N} } \right), $$

where $\Re(\cdot)$ and $\Im(\cdot)$ represent taking real and imaginary part of a complex number respectively. Note that this is done for each $n \in \{0 \ldots N-1\}$

Note that because of circular symmetry of DFT, $X[N] = X[0]$, so you'll end up adding up the same thing twice according to the formula above. If you do that, then the actual $a_0$ is half of what you get according to the formula above. If you find this division by 2 confusing, this section of Wikipedia article on Fourier Series may provide a better explanation (look for the formula where $a_0$ is divided by 2).