Qiaochu Yuan's **original** answer was very helpful, but working through it left me with a question or two. I couldn't put the workings in a comment so I put them here. It turned out that there was a misunderstanding as to exactly what coefficients I wanted. Once that was resolved, his original answer sufficed. However, just in case someone else ponders this question, I'll leave my workings here to save them the effort.

Following the hint from Qiaochu, we start from

$$
\sum_{n=0} x^n = (1 - x)^{-1}
$$

and integrate term-by-term to get

$$
\sum_{n=1} \frac{1}{n} x^n = -\log(1 - x)
$$

now we substitute in $x = e^{\pi i t}$ to get

$$
\sum_{n=1} \frac{1}{n} e^{n \pi it} = -\log(1 - e^{\pi i t})
$$

of which we then take the real part:

$$
\sum_{n=1} \frac{1}{n} \cos(n \pi t) = -\Re\log(1 - e^{\pi i t})
$$

Excluding the case where $t=0$, we can use the standard branch of the logarithm and so use the identity $\log(r e^{i\theta}) = \log(r) + i\theta$ to deduce that we want the logarithm of the absolute value of $1 - e^{\pi i t}$. Since squaring is easily taken care of, we are lead to consider:

$$
|1 - e^{\pi i t}|^2 = (1 - e^{\pi i t})(1 - e^{-\pi it}) = 1 - e^{\pi i t} - e^{-\pi it} + 1 = 2 - 2 \cos(\pi t)
$$

and thus conclude that

$$
\sum_{n=1} \frac{1}{n} \cos(n \pi t) = - \frac{1}{2} \log 2(1 - \cos(\pi t))
$$