TITLE: Maximality and non-Hausdorffness
QUESTION [6 upvotes]: We say that a non-$T_2$ topology $\tau$ on a set $X$ is maximal non-$T_2$ if every topology $\tau'$ strictly containing $\tau$ is $T_2$.

Is every non-$T_2$ topology contained in a maximal non-$T_2$ topology?

REPLY [7 votes]: Yes, every non-Hausdorff topology is contained in a maximal non-Hausdorff topology.
To see this, let's start with a different question: What do the maximal non-Hausdorff topologies on an infinite set look like?
To answer this auxiliary question, let $Y = X \cup \{p,q\}$ be an infinite set, $p,q \notin X$. Suppose $\mathcal U$ is an ultrafilter on $X$ and consider the topology on $Y$ defined by

Every point of $X$ is isolated.
Sets of the form $\{p\} \cup A$, where $A \in \mathcal U$, form a neighborhood basis for $p$.
Sets of the form $\{q\} \cup A$, where $A \in \mathcal U$, form a neighborhood basis for $q$.

Let us call this topology $\tau$. It is easy to see that $\tau$ is a non-Hausdorff topology on $Y$.
I claim that any proper refinement of $\tau$ is Hausdorff. To see this, let us consider topologies of the form $\langle \tau \cup \{B\} \rangle$ where $B \subseteq Y$ (recall that $\langle \tau \cup \{B\} \rangle$ is defined to be the smallest topology that refines $\tau$ in which $B$ is open; equivalently, it is the topology having $\tau \cup \{B\}$ as a sub-basis). It is not too hard to check that any proper refinement of $\tau$ having this form is Hausdorff. [Here is a short proof. If $p,q \notin B$ or if $X \cap B \in \mathcal U$, then $\langle \tau \cup \{B\} \rangle = \tau$. Thus we may assume that at least one of $p$ and $q$ is in $B$, and that $B \cap X \notin \mathcal U$. If only one of $p$ or $q$ is in $B$, $\langle \tau \cup \{B\} \rangle$ is Hausdorff (in fact, a maximal non-discrete topology). If both are in $B$, $\langle \tau \cup \{B\} \rangle$ is the discrete topology.]
Now suppose $\tau'$ is any topology properly refining $\tau$ (we do not assume it has the form $\langle \tau \cup \{B\} \rangle$ for some $B \subseteq Y$). Since $\tau'$ is a proper refinement, there is some $B \in \tau' - \tau$. By the previous paragraph, $\langle \tau \cup \{B\} \rangle$ is Hausdorff. Any refinement of a Hausdorff topology is Hausdorff, so $\tau'$ is Hausdorff. Therefore the topology described above really is a maximal non-Hausdorff topology.
Now that we know what (at least some of) the maximal non-Hausdorff topologies look like, we can answer Dominic's question. Let $\sigma$ be any non-Hausdorff topology on an infinite set $Y$ (the question is trivial for finite sets). Let $p,q$ be two points in $Y$ that cannot be separated with open sets. Let $X = Y - \{p,q\}$ and observe that
$$\mathcal F = \{U \cap V \cap X : p \in \mathrm{Int}(U) \ \text{ and } \ q \in \mathrm{Int}(V)\}$$
is a filter on $X$. Let $\mathcal U$ be any ultrafilter on $X$ extending $\mathcal F$. Then the topology described above is a maximal non-Hausdorff topology refining $\sigma$.
Incidentally, this also shows that every maximal non-Hausdorff topology has the form of the topology $\tau$ described above.