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$?

$$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$.
