Meaning of infinity in $f:\mathbb R^n\rightarrow \mathbb R\cup \{\pm\infty\}$? I know that $f:\mathbb R^n\rightarrow \mathbb R$ mean a real function of $n$ variables and the image is a real number. But what is the meaning of infinity in the following:

$$
f:\mathbb R^n\rightarrow \mathbb R\cup \{\pm\infty\}
$$

I also appreciate an example.
 A: The meaning of the expression $f\colon \mathbb{R}^n\to \mathbb{R}\cup\{\pm\infty\},$ is that the codomain of $f$ is the set of all real numbers union the two formal symbols $+\infty$ and $-\infty$ (read "positive infinity" and "negative infinity"). So the output of the function may be a real number, or it may be $\pm \infty.$
The usage of this notion is that for example this may allow you to extend the domain of the function $f(x) = \frac{1}{x^2}$ to include zero, by saying $f(0)=+\infty.$ 
More importantly, you may talk about for example the $\limsup$ of any sequence. Even divergent sequences have a limit superior if you allow infinity to be a number.
There is a natural topology on the real line with $\pm\infty$ included, called the extended real line, where the entire line $[-\infty,+\infty]$ now looks like a closed interval (of infinite length) with its endpoints included. And this function $f$ is even continuous at zero with respect to this topology.
Although the extended real line is not a field or an abelian group, because expressions like $\infty-\infty$ or $\infty/\infty$ are not defined, still this set does allow an extension of some algebraic operations. For example it is consistent to define $\infty+1=\infty.$
A: More general, $f\colon A\to B$ means that we deal with a function from the set $A$ to the set $B$. In order words, for a function $f\colon\Bbb R^n\to \Bbb R\cup\{\pm\infty\}$, a function value $f(x_1,\ldots,x_n)$ may either be a real number or $+\infty$ or $-\infty$.
A: Formally, one would define $\infty$ as an element that doesn’t belong to the real numbers, e.g., $\infty:=\{\mathbb R\}$.
