How do we know that a map $f: U \to Y$ extends to $\bar{U}$? I read the following fact: if $U$ is an open subset of $P_k^1$ and $f: U \to U$ is an automorphism of schemes, then $f$ extends to an automorphism of $P_k^1$.  Thus I was curious: is there a general criteria for when a continuous map defined on an open subset $U \subset X$ extends to $X$ (especially in non-Hausdorff settings, preferably including the aforementioned case)?
 A: Your example is in the category of schemes, but you then ask about maps of topological spaces. 
Assuming you care about schemes, the condition is that the source is one dimensional and regular, and the target is proper. That you can extend in this case is essentially the valuative criterion of properness; that you can't extend in any other case is basically the valuative criterion of properness plus Scott's argument.
If you care about topological spaces, I don't know that there is any good criterion. Having the source be a one dimensional manifold and the target compact is not enough: Consider the line segment $(0,1)$ mapping to a closed disc in $\mathbb{R}^2$ by $x \mapsto (x, \sin 1/x)$; you can't extend to $[0,1]$. (Take the closed disc is large enough to contain the image of the map.)
A: The scheme example is not quite the same as the topological case, but it is related.  Scott nicely argues what happens in the context of schemes, or algebraic varieties.  If you just take the topology of the motivating example, then actually every set-theoretic permutation (of the closed points of the scheme) is continuous, because the topology is just the cofinite topology.
In the topological category you can't say much either, but in the topic of topology taken broadly you can.  There is one widely seen circumstance in which you know that an extension exists.  If $X$ is a uniform space and $U$ is dense, whether or not it is open, then a uniform map $U \to Y$ extends uniquely to a map $X \to Y$.  In fact, your example fits this pattern, if your projective line $P^1$ is over $\mathbb{C}$ and you switch from the Zariski topology to the analytic topology.  Every compact Hausdorff space is a uniform space, and any subset can inherit the uniformity of its parent.  So in particular every quasiprojective variety is a uniform space using the analytic topology on projective space, and as it happens every Zariski open set is analytically dense.  (Of course in this setting, "uniform space" is just a fancy way of saying "metric space"; quasiprojective varieties are naturally Riemannian manifolds.)
Actually, you can also achieve all of this in a "pseudo-positive-characteristic" setting too, namely using varieties or schemes defined over a $p$-adic field.  Then once again there is an analytic topology in which you can make all of this work.
A: For the automorphism question, I think a first criterion is that X is smooth and one dimensional.  Otherwise, you can take a nontrivial finite order automorphism of a higher-dimensional scheme Z, blow up a non-fixed point to get X, and delete the orbit of that point to get U.
In general, this is a question about the target space.  If Y is universally closed then you get an extension.
