Find $\lim_{x\rightarrow\infty}x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right).$ This is what my prof did:
Rewrite as $$x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right)=\frac{x}{e}\left(1-e\cdot e^{-x\ln{\left(1+\frac{1}{x}\right)}}\right).$$
Here he uses that
$$\ln{(1+t)}=t-\frac{t^2}{2}+O(t^3),$$
so 
$$\frac{x}{e}\left(1-e\cdot e^{-x\left(\frac{1}{x}-\frac{1}{2x^2}+O(\frac{1}{x^3})\right)}\right)=\frac{x}{e}\left(1-e^{\frac{1}{2x}+O\left(\frac{1}{x^3}\right)}\right).$$
So far so good. Now, he uses that $e^t=1+t+O(t^2)$ so that the expression aove becomes
$$\frac{x}{e}\left(1-\left(1+\frac{1}{2x}+O\left(\frac{1}{x^2}\right)\right)\right)=-\frac{1}{2e}+O\left(\frac{1}{t}\right)$$
and now he lets $x\rightarrow\infty$ to get the answer. However, when he introduces the expansion of $e^t$, how does he get $O(1/x^2)$? 
It is my understanding that I should plug in $t=\frac{1}{2x}+O\left(\frac{1}{x^3}\right)$ everywhere in $1+t+O(t^2),$ doing that I get
$$1+\frac{1}{2x}+O\left(\frac{1}{x^3}\right)+O\left(\left(\frac{1}{2x}+O\left(\frac{1}{x^3}\right)\right)^2\right),$$
Squaring that last ordo-term, the largest power of $x$ is $1/x^2$ and the smallest is $1/x^6.$ Why choose $1/x^2$?
 A: $$O\left(\left(\frac{1}{2x}+O\left(\frac{1}{x^3}\right)\right)^2\right)=O\left(\frac{1}{4x^2}+O\left(\frac{1}{x^4}\right)+O\left(\frac{1}{x^6}\right)\right)=O\left(\frac{1}{x^2}\right)$$
because you let $x\to \infty$ and $\frac{1}{x^6}$ approaches $0$ much faster than $\frac{1}{x^2}$, so you choose $\frac{1}{x^2}$, the "slowest of the penguins". Here you can estimate $\frac{1}{x^6}$ by $\frac{1}{x^2}$.
Compare it with choosing $O\left(x^2\right)$ when you could choose between $x^2$ and $x^6$: if you let $x\to 0$, then $x^6$ goes much faster, so you only need to consider the terms of orders of $x^2$. Here you would estimate $x^6$ by $x^2$.
A: Probably too long for a comment.
Having felt in love with Taylor series and their compositions, I still think that simpler is always better and allows probably more.
Considering
$$A=x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right)$$ let us try working the pieces
$$B=\left(\frac{x}{x+1}\right)^x\implies \log(B)=x\log\left(\frac{x}{x+1}\right)=-x\log\left(1+\frac1{x}\right)$$ $$\log(B)=-x\left(\frac{1}{x}-\frac{1}{2 x^2}+\frac{1}{3
   x^3}-\frac{1}{4
   x^4}+O\left(\frac{1}{x^5}\right)\right)=-1+\frac{1}{2 x}-\frac{1}{3 x^2}-\frac{1}{4
   x^3}+O\left(\frac{1}{x^4}\right)$$ Continuing with Taylor
$$B=e^{\log(B)}=\frac{1}{e}+\frac{1}{2 e x}-\frac{5}{24 e
   x^2}+\frac{5}{48 e
   x^3}+O\left(\frac{1}{x^4}\right)$$ making
$$A=x\left(-\frac{1}{2 e x}+\frac{5}{24 e x^2}-\frac{5}{48 e
   x^3}+O\left(\frac{1}{x^4}\right)\right)=-\frac{1}{2 e}+\frac{5}{24 e x}-\frac{5}{48 e
   x^2}+O\left(\frac{1}{x^3}\right)$$ which shows the limit and how it is approached.
Now, truncate to $O\left(\frac{1}{x^2}\right)$ or $O\left(\frac{1}{x}\right)$ as you wish.
At least, you can avoid some useless gymnastics.
A: From here you get
$$e^{-x\left(\frac{1}{x}-\frac{1}{2x^2}+O\left(\frac{1}{x^3}\right)\right)}=e^{-1+\frac{1}{2x}+O\left(\frac{1}{x^2}\right)}=\frac1e\cdot e^{\frac{1}{2x}+O\left(\frac{1}{x^2}\right)}=\frac1e \cdot \left(1+\frac{1}{2x}+O\left(\frac{1}{x^2}\right)\right)$$
Alternatively with little-o notation
$$\left(\frac{x}{x+1}\right)^x=\left(\frac{1}{1+\frac1x}\right)^x=e^{-x\log\left(1+\frac1x\right)}=e^{-x\left(\frac1x-\frac1{2x^2}+o\left(\frac1{x^2}\right)\right)}=e^{-1+\frac1{2x}+o\left(\frac1{x}\right)}=$$
$$=-\frac1e+\frac1{2ex}+o\left(\frac1{x}\right)$$
Thus
$$x\left(\frac{1}{e}-\frac1e-\frac1{2ex}+o\left(\frac1{x}\right)\right)=-\frac1{2e}+o(1)\to-\frac12$$
A: The whole argument must be understood for $t=1/x\to0$, so that the lowest exponents yield the largest terms ($t^2$ exceeds $t^4$ because $1$ exceeds $t^2$; if you prefer, $1/x^2$ exceeds $1/x^4$ because $x^4$ exceeds $x^2$).
Then
$$e^{t+O(t^3)}=1+t+O(t^3)+O\left(\left(t+O(t^3)\right)^2\right)=1+t+O(t^2)$$ by keeping the terms of lowest degree.
A: $$\lim_{x\rightarrow\infty}x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right)=\lim_{x\rightarrow0}\frac{\frac{1}{e}-\left(\frac{\frac{1}{x}}{\frac{1}{x}+1}\right)^{\frac{1}{x}}}{x}=\lim_{x\rightarrow0}\frac{(1+x)^{\frac{1}{x}}-e}{ex(1+x)^{\frac{1}{x}}}=$$
$$=\frac{1}{e^2}\lim_{x\rightarrow0}\left((1+x)^{\frac{1}{x}}\right)'=\frac{1}{e^2}\lim_{x\rightarrow0}\left(e^{\frac{\ln(1+x)}{x}}\cdot\left(\frac{1}{x(1+x)}-\frac{\ln(1+x)}{x^2}\right)\right)=$$
$$=\frac{1}{e}\lim_{x\rightarrow0}\frac{x-(1+x)\ln(1+x)}{x^3+x^2}=\frac{1}{e}\lim_{x\rightarrow0}\frac{1-\ln(1+x)-1}{3x^2+2x}=$$
$$=-\frac{1}{e}\lim_{x\rightarrow0}\left(\frac{\ln(1+x)}{x}\cdot\frac{1}{3x+2}\right)=-\frac{1}{2e}.$$
