If the problem was \(\displaystyle \int \frac{1}{2+ e^{-x}}dx\), then multiplying both numerator and denominator by \(\displaystyle e^x\) gives \(\displaystyle \int \frac{e^x}{2e^x+ 1}dx\). An "obvious" substitution would be \(\displaystyle u= 2e^x+ 1\). Do you see why you need the "\(\displaystyle e^x\)" in the numerator?
If the problem really was \(\displaystyle \int\frac{1}{2+ e^x}dx\), then multiplying both numerator and denominator by \(\displaystyle e^{-x}\) gives \(\displaystyle \int \frac{e^{-x}}{2e^{-x}+ 1}dx\) and an "obvious" substitution would be \(\displaystyle u= 2^{-x}+ 1\). Do you see why you need the "\(\displaystyle e^{-x}\)" in the numerator?