In a topology course we proved the following theorem:
Let $X$ be any space, $D \subseteq X$ dense, $Y$ a compact $T_3$ space and $f: D \to Y$ be any continuous map, s.t. for all disjoint closed $A, B \subseteq Y$: $\overline{f^{-1}(A)} \cap \overline{f^{-1}(B)} = \emptyset$ holds (the closure regards to $X$). Then there is a continuous extension of $f$ to $X$.
This theorem seems quite powerful to me, because its proof involves many filter/ultrafilter computations, but nevertheless I don't know a single application. Can you name some to me?
Thank you in advance!
//edit:
@Henno Brandsma, Paulo H.: thank you for your really interesting answers!
I still wonder, whether there are further applications outside general topology (e.g. analysis, measure theory). Are there particular functions which become surprisingly easy to define using this theorem (note that there is a unique extension, if $Y$ is additionally Hausdorff)?