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)?



How do we know that a map $f: U \to Y$ extends to $\bar{U}$?
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.)


