Infinite topological spaces such that every subset is a retract Let $X$ be an infinite set and let $(X,\tau)$ be a topological space such that for every non-empty $A\subseteq X$ there is a continuous map $r:X\to A$ such that $r(a) = a$ for all $a\in A$. Does this imply that $\tau$ is either discrete ($\tau = \mathcal{P}(X)$) or indiscrete ($\tau = \{\emptyset, X\}$)?
 A: Say a space $X$ is totally retracting if every nonempty subset of $X$ is a retract.  Then I claim that $X$ is totally retracting iff its $T_0$ quotient is a disjoint union of spaces $X_i$ such that each $X_i$ is isomorphic to a finite chain, $\mathbb{N}$, $-\mathbb{N}$, or $\mathbb{Z}$ with the Alexandrov topology.
First, it is easy to see that $X$ is totally retracting iff its $T_0$ quotient is, so we may assume $X$ is $T_0$.  Also, a disjoint union of totally retracting spaces is totally retracting, so the "if" direction is easy (see Emil's answer for the case of $\mathbb{N}$, and the others are similar).
Thus let $X$ be a totally retracting $T_0$ space; we want to write it as a disjoint union of simple chains with the Alexandrov topology.  Let $\leq$ denote the specialization order on $X$ and let $\{X_i\}$ be the connected components of $X$ with respect to $\leq$.  If $A\subseteq X$ contains one point from each $X_i$, then $A$ is $T_1$.  Any subset of a totally retracting space is totally retracting, so it follows that $A$ is discrete (see Francois's comment).  But any continuous map must preserve the specialization order, so it follows that if $r:X\to A$ is a retraction, the preimage of any point of $A$ is the unique $X_i$ that contains it.  Since $A$ is discrete, it follows that $X$ is the disjoint union of the $X_i$.
We thus may assume that $X$ is connected with respect to $\leq$, and we wish to show that $X$ is isomorphic to a finite chain, $\mathbb{N}$, $-\mathbb{N}$, or $\mathbb{Z}$ with the Alexandrov topology.  First, since $X$ is connected, every subset of $X$ must be connected, and so $\leq$ must be a total order.  Now suppose there is an infinite increaseing sequence $x_0<x_1<\dots$ in $X$ and an element $y\in X$ such that $x_n<y$ for all $n$.  Let $A=\{x_0,x_1\dots\}\cup\{y\}$ as a subspace of $X$.  Then $\{x_0,x_1\dots\}$ cannot be a retract of $A$ (there's nowhere for $y$ to go), so $A$ is not totally retracting.  This is a contradiction, so there can be no infinite increasing sequence in $X$ that is bounded above.  By a similar argument, there can be no infinite decreasing sequence that is bounded below.
It follows that for any $x<y$ in $X$ there are only finitely many $z$ such that $x<z<y$.  From this it follows easily that as an ordered set, $X$ is isomorphic to either a finite chain, $\mathbb{N}$, $\mathbb{-N}$, or $\mathbb{Z}$.  It remains to be shown that $X$ has the Alexandrov topology. To prove this, we must show that for any $x\in X$, $U_x=\{y:y\geq x\}$ is open.  Let $x-1$ be the predecessor of $x$ with respect to the ordering (if $x$ is the least element, $U_x$ is trivially open).  Since $x\not\leq x-1$, there exists an open set $U$ that contains $x$ but does not contain $x-1$.  It is now easy to see that $U=U_x$.
A: Let $X=\mathbb N$ with the Alexandrov topology corresponding to the usual order. Then if $A\subseteq X$ is nonempty,
$$r(x)=\begin{cases}\min(A)&x<A\\
\max(A\cap\{0,\dots,x\})&\text{otherwise}\end{cases}$$
defines a retraction of $X$ to $A$ (continuity follows from the fact that it is nondecreasing).
A: One can completely characterize such spaces $X$ using the specialization order $x \leq y \iff x \in \overline{\{y\}}$. (In general, this is a preorder but, as Eric Wofsey observed, one can pass to the $T_0$ quotient of $X$ to get a partial order.)
First note that if $x,y \leq z$ then either $x \leq y$ or $x \geq y$. Suppose on the contrary that $x$ and $y$ are incomparable and let $r:X \to \{x,y\}$ be a retract. Since $\{x,y\}$ is discrete, $r^{-1}(r(z))$ is a closed set containing $z$ but only one of $x,y$, contrary to the assumption that $x,y \leq z$.
It follows that the specialization order of $X$ is a disjoint union of chains. So let's focus on the case where the specialization order consists of just one chain. Then $X$ has the required property if and only if for every $A \subseteq X$ there is an order preserving $r:X \to A$ such that $r(a) = a$ for every $a \in A$.
We now see that the chain $X$ must have the property that every $A \subseteq X$ which is bounded above/below must have a maximal/minimal element. Indeed, if $A$ is bounded below by $b$ and $r:X\to A$ is a retract, then $r(b)$ must be the minimal element of $A$; symmetrically if $A$ is bounded above.
The chains with this property are, up to isomorphism, the subchains of $\mathbb{Z}$. It's easy to see, as in Emil's answer, that $\mathbb{Z}$ with the Alexandrov topology has the required property. Since the property is inherited by subspaces, we see that the $T_0$ spaces with the desired property are, up to homeomorphism, subspaces of $\coprod_{i \in I} \mathbb{Z}$ where each copy of $\mathbb{Z}$ has the Alexandrov topology.
