For the integrand $\frac{\cos(1/x)}{x^2}$, substitute $u = \frac1 x$ and $\def\d{\,\mathrm{d}} \d u = -\frac1{x^2}\d x$.
This gives a new lower bound $u = \frac1{1/\pi} = \pi$ and upper bound $u = \frac1{2/\pi} = \frac{\pi}{2}$. Now, our integral becomes:
$$\begin{align}
I &= - \int\limits_\pi^{\pi/2} \cos(u) \d u\\[1em]
&= \int\limits_{\pi/2}^\pi \cos(u)\d u
\end{align}$$
Since the antiderivative of $\cos(u)$ is $\sin(u)$, applying the fundamental theorem of calculus, we get:
$$\begin{align}
I &= \sin(u)\biggr |_{\pi/2}^\pi\\[1em]
&= \sin(\pi) - \sin \left ( \frac\pi 2\right )\\[1em]
&= 0 - 1\\[1em]
I &= -1
\end{align}$$