<s>[INST] How to calculate $\lim_{x \to 0}\left(\frac1{x} + \frac{\ln(1-x)}{x^2}\right)$? How to calculate the following limit?
$$\lim_{x \to 0}\left(\frac1{x} + \frac{\ln(1-x)}{x^2}\right)$$
 [/INST] You have
\begin{eqnarray*}
\lim_{x\to 0} \left(\frac{1}{x}+\frac{\ln(1-x)}{x^2}\right) &=& \lim_{x\to 0} \frac{x+\ln(1-x)}{x^2},
\end{eqnarray*}
note that
$$ \lim_{x\to 0} x+\ln(1-x)=0,\: \lim_{x\to 0} x^2= 0, $$
then by the L'Hospital's rule
$$\begin{align*}
\lim_{x\to 0} \left(\frac{1}{x}+\frac{\ln(1-x)}{x^2}\right)&= \lim_{x\to 0} \frac{\frac{d}{dx}(x+\ln(1-x))}{\frac{d}{dx}x^2}\\
&= \lim_{x\to 0} \frac{1-\frac{1}{1-x}}{2x}\\
&= \lim_{x\to 0}\frac{\frac{1-x - 1}{1-x}}{2x}\\
&= \lim_{x\to 0} \frac{\frac{x}{x-1}}{2x}\\
&= \lim_{x\to 0}\frac{1}{2(x-1)}\\
&= -\frac{1}{2}.
\end{align*}$$
</s>