The $\infty$ and $2$ make the integral **definite.** You are calculating the integral on the closed interval $[2,\space\infty]$ where $\infty$ is the upper bound and $2$ is the lower bound. How to deal with **definite integrals** is that you substitute the upper and lower bounds respectively into the remaining function and then subtract (the lower bound from the upper bound). So: $$-\frac{1}{f(x)}\bigg|_2^{\infty} = -\frac{1}{f(\infty)}-\left(-\frac{1}{f(2)}\right)$$
From your comment, you wouldnt have "$\int g(x)\bigg|_2^{\infty}$" together, the "$\bigg|_2^{\infty}$" notation is **after you have integrated** $g(x)$ and will be substituting the lower and upper bounds..
$$\int_2^{\infty} g(x) dx=h(x)\bigg|_2^{\infty} = h(\infty)-h(2)$$
where $h(x)$ is the **integral** of $g(x)$. You can read more here.
For example, $$\int_2^{10}6x^5=x^6\bigg|_2^{10}=10^6-2^6=...$$