This is a pretty broad question (still, I like pretty broads). Some results:
Tietze Extension: If A is a closed subset of a normal space X, and f:A-->R is continuous, then f extends continuously to X (this is constructive result, i.e., there is a method to construct the extension).
If f is a uniformly-continuous function on the rationals, then f extends to the reals. Use the fact that uniformly-continuous functions preserve Cauchy-sequences, and use the continuity condition: f continuous ( in metric or 1st-countable space) iff [(x_n-->x)->(f(x_n)-->f(x))] ; left-right is true in any topological space (use nets instead of sequences for general non-metrizable). Note that continuity alone is not enough: use, e.g: f(x)=1/(x-sqr2), or 1/(x-pi) from rationals to rationals, it is continuous, but does not extend .
There are also results on functions on manifolds defined on individual charts, that can be put together into globally-defined functions, using partitions of unity. This uses the fact that manifolds are paracompact (I think Hausdorff +2nd-countable => paracompact). If you want more detail, let me know, because I need to go to sleep soon.
Harder stil, is the extension of homeomorphisms from a subspace into the superspace. In the case of S^4, if the subspace is trivially-embedded (i.e., unknotted, or any two embeddings are isotopic to each other) , then the maps that extend are precisely those that preserve a quadratic form called the Rohklin form.