I am familiar with basic undergraduate topology. For example, I know the process of one point compactification of a non-compact topological space, and how it applies to, say, $\mathbb R^2$. My question is:
Can I define and topologize $[-\infty, \infty]$ or $[0, \infty]$ in a similar way?
If so, how to describe a continuous function from some topological space $X$ to this $[-\infty, \infty]$ or $[0, \infty]$? Moreover, will $[-\infty, \infty]$ or $[0, \infty]$ be compact?
In order to carry out a one-point compactification, you start with a topological space. So you have to decide what topology you're going to give $[-\infty, \infty]$ and $[0, \infty]$.
One possible topology you could give $[0, \infty]$ is to give a subbasis consisting of stuff like $[0,a)$ and $(a,\infty]$. That would give you the normal topology when you restricted to $[0,\infty)$. Similarly for $[-\infty, \infty]$ give a subbasis of $[-\infty, a)$ and $(a, \infty]$**.
These are both going to end up being homeomorphic to $[0,1]$, and so compact. Hint: find an explicit homeo by playing around with the arctangent function.
**If I topologize $[0, \infty]$ this way, it is the one-point compactification of $[0,\infty)$. But $[-\infty, \infty]$ is not the one-point compactification of $(-\infty, \infty)$, because I added two points.