How can you calculate the integral $\int_{-1}^1\frac{\cos x}{e^{1/x}+1}\;dx$? How can you calculate the following integral 
$$
\int_{-1}^1\frac{\cos x}{e^{1/x}+1}\;dx=\;?
$$

First of all, there is no problem at the singularity $x=0$:
$$
\lim_{x\to 0+}\frac{\cos x}{e^{1/x}+1}=0, \quad \lim_{x\to 0-}\frac{\cos x}{e^{1/x}+1}=1\;.
$$

The integral per se is not very appealing: who cares what the value is? But the methods to handle it may be very interesting. I was very surprised when I first saw one trick (see my answer below) to solve this problem; it turns out that that trick is connected to Fourier analysis in some sense. 
I look forward to seeing alternative approaches if any.
 A: Any real-valued function $f:\mathbf{R}\to\mathbf{R}$ can be written as a sum $f = f_o+f_e$ where $f_o$ is an odd function: $f_o(-x)=-f_o(x)$ and $f_e$ is even: $f_e(-x)=f_e(x)$. Such decomposition is a simple prototype of the Fourier transform. 1 The proof is simple:
$$
f_o(x) := \frac{f(x)-f(-x)}{2},\quad f_e(x) := \frac{f(x)+f(-x)}{2}\;.
$$
Now, if one denotes the integrand as $\displaystyle f(x) = \frac{\cos(x)}{e^{1/x}+1}$ and decomposes it as above, then one immediately has
$$
\int_{-1}^1f(x)\;dx = \int_{-1}^1f_e(x)\;dx\tag{1}
$$
because the integral of any odd functions on a symmetric interval is zero. So the problem reduces to (1). But
$$
2f_e(x) = \frac{\cos(x)}{e^{1/x}+1}+\frac{\cos(x)}{e^{-1/x}+1} 
= \cos(x)\cdot \frac{e^{-1/x}+1+e^{1/x}+1}{2+e^{1/x}+e^{-1/x}}=\cos(x)\tag{2}
$$
One can now easily go on with (2) to find the answer.2

Notes.


*

*See this excellent PCM (The Princeton Companion to Mathematics) article on the Fourier transform by Terence Tao. See also Section 5 of this set of lecture notes by Tao on how the even and odd decomposition relates to the Fourier transform. 

*This method is also presented in Nahin's Inside Interesting Integrals. 

A: Note
$$
\int_{-1}^1\frac{\cos x}{e^{1/x}+1}\;dx
= \int_{-1}^0\frac{\cos x}{e^{1/x}+1}\;dx +\int_{0}^1\frac{\cos x}{e^{1/x}+1}\;dx \\
\overset{x=-t} = \int_{0}^1\frac{\cos t}{e^{-1/t}+1}\;dt +\int_{0}^1\frac{\cos x}{e^{1/x}+1}\;dx \\
= \int_{0}^1\cos t \left(\frac{1}{e^{-1/t}+1}+\frac{1}{e^{1/t}+1}\right)\;dt \\
\hspace{-2cm}= \int_{0}^1\cos t dt= \sin (1)
$$
