Given a continuous function $f: S \rightarrow Y$ of topological spaces, when can we extend the domain? Let $X, Y$ be topological spaces and let $S \subseteq X$ be equipped with the subspace topology.  Suppose $f: S \rightarrow Y$ is continuous.  Under what conditions can we guarantee there exists a continuous function $\tilde{f}: X \rightarrow Y$ extending $f$ (i.e. $\tilde{f}|_S = f$)?
It appears to me that this isn't always possible.  For example, let $\Omega$ be the least uncountable ordinal, and let $X = \Omega \cup \{ \Omega \}$ the be set of all ordinals up to and including $\Omega$ equipped with the order topology.
Then it seems that the identity map $1: \Omega \rightarrow \Omega$ can't be extended to $\tilde{1}: \Omega \cup \{\Omega\} \rightarrow \Omega$.
I'm wondering what the obstruction is here, exactly, because it seems like the same sort of argument could work for a one-point compactification (of, say, $\mathbb{R}$), which is a nicer space than these ordinals.
 A: There is indeed no map extending the identity $1 : \omega_1 \rightarrow \omega_1$ to $\tilde{1} : \omega_1 \rightarrow (\omega_1 + 1)$. This is because if $\tilde{1}$ existed, it's image would be some $\alpha < \omega_1$ and then the inverse image $\tilde{1}^{-1}[(\leftarrow, \alpha+1)]$ is countable (as $1$ is 1-1 and so $\tilde{1}$ is at most 2-to-1, and the neighbourhood is countable) but should be an open subset containing $\omega_1$, all of which are uncountable.
A function from $X$ to some space $Y$ can be extended to the one-point compactification of $X$, $\alpha X$, if it exists, only under some conditions on the function. It should have a "limit at infinity" in $Y$. For the reals e.g. this means that $\lim_{x \rightarrow \infty} f(x) = \lim_{x \rightarrow -\infty} f(x)$ should exist and be finite.
There is one special compactification of $X$, called $\beta X$, which exists for all completely regular $T_1$ spaces (so for all metric ones in particular), so that we can extend any continuous map from $X$ to any compact Hausdorff space $Y$ to $\beta X$ (and $\beta X$ is compact Hausdorff and contains $X$ as a dense subspace). This extension property characterises $\beta X$, in fact. 
If $Y$ is nice (like the reals or all Euclidean spaces, or many topological vector spaces, or compact balls...) then we extend a continuous $f$ from a closed subset $A$ of $X$ to $Y$ to all of $X$ to $Y$. This generalises the Tietze-Urysohn theorem. 
For nice spaces (at least metric) we can extend a continuous $f$ from a closed subset $A$ of $X$ to $\mathbb{S}^n$ to all of $X$ iff $\dim(X) \le n$ (alexandroff theorem), so there an extension property to a special space characterises the topological dimension.
For metric spaces we have a classical theorem that we can extend a map from $(X,d)$ to a complete metric space $Y$ from $X$ to a $G_\delta$ around $X$, in the completion $(\tilde{X},\tilde{d})$ of $(X,d)$. This is a metric analogue of the compactification theory, in a way.
So also in general topology such problems have been studied a lot. 
A: Have a look at Davis and Kirk's Lecture Notes in Algebraic Topology (you can freely download it). Chapter $7$, page $165$.
Roughly speaking, at least when we are dealing with CW-complex (i.e in your case we must assume $(X,S)$ a relative CW-complex). The obstruction for extending a map from the $n$ skeleton to the $n+1$-skeleton is a certain cocycle in $C^{n+1}(X,A;\pi_nY)$ which is explained in theorem $7.1$, page $169$.
Clearly the condition to the lack of this obstruction is not easily satisfied: Just think about this example to see a (very simple) map which cannot be extended. 
Take the identity $$Id \colon S^1 \to S^1$$ and consider $S^1\subset D^1$ the usual disk. If the identity extends to a map $D^1\to S^1$ then it would be a null-homotopic map, which is not true (it's the generator of the fundamental group of the circle which is $\mathbb{Z}$). On the other hand, any map $$f\colon S^1 \to D^1$$ can be extended to a map $D^1 \to D^1$ using the fact that $D^1$ has vanishing fundamental group. This family of examples can be generalised to map form spheres and in general are fairly well-understood, motivating why working with CW-complexes (which are glued spheres) is "extremely" useful in these contexts.
Side note: If you relax your hypothesis on the extension problem (so extensions only in specific cases and with specific families of maps) then something more can be said in the case $(X,A)$ CW-pair, just have a look at the notion of cofibration.
I don't know much in the realm of non-CW spaces (i.e. Pathological spaces) though, so i can't provide you with references for this case. 
