Prove that a compact subset of a Hausdorff space is closed. Give an example which shows that the "Hausdorff" assumption is required. 
Prove directly from the definitions, that a compact subset of a Hausdorff space is closed. Give an example which shows that the "Hausdorff" assumption is neccessary.

Let $X$ be a topological space and $A \subset X$ compact. Let $x \in X \setminus A$. For every $a \in A$ pick disjoint neighborhoods $U_a$ of $a$ and $V_x(a)$ of $x$. Since $A$ is compact, the set $\{U_a \mid a \in A\}$ is a cover of $A$ and thus has a finite subcover $\{U_a \mid a \in F \}$ for $F$ finite. Now $$U= \bigcup \{U_a \mid a \in F\} \text { and } V=\bigcap\{V_x(a) \mid a \in F\}$$ are disjoint neighborhoods of $A$ and $\{x\}$.
Using this we can find a neighborhood $V_x$ for $x \in X \setminus A$ that is disjoint from $A$ and therefore $x \in V_x \subset X \setminus A$ implies that $X \setminus A$ is open and $A$ closed.
I don't know how I can give an example that this doesn't work without the Hausdorff condition. The simplest non-Hausdorff space I could think of was $(X, \{X, \emptyset\})$, but I don't know if I can work with this as I don't have any neighborhoods for the points except for $X$ itself?
 A: You correctly show that a compact subset of a Hausdorff space is closed (I made a little edit in your question).
Now let $X$ be any space with the trivial topology which has more than one element. For each $x \in X$ the set $\{x\}$ is compact, but not closed.
A: Take the Sierpinski space $X:=\{0,1\}$ where
the topology is $\tau:=\{ \emptyset, X, \{1\}\}$.
Then $\{1\}$ is compact but not closed.
A: $(X, \tau) $ be a topological space where every compact subsets are closed is called K-C space.
Hausdorff spaces provide a large class of examples of KC space.
But KC space need not be $T_2$- space.
Example: $(X, \tau_{\text{cofinite}}) $ . Then every subsets of $X$ are compact  but closed subsets are all finite sets and $X$ itself. Not all  subsets are finite! (Note : $X$ is here an infinite set, otherwise cofinite topology induced the discrete topology)
A: One can consider the line with 2 origins, which is a more complicated example.
Let ~ be an equivalent relation on the space $\mathbb{R}\times \{0,1\}$(i.e. the union of two real line) defined by $x\times n_1\sim y\times n_2\Leftrightarrow (x=y,x\neq 0) $, and consider the space $\mathbb{R}\times \{0,1\}\big/\sim := X $.Let $q$ denote the correspoding quotient map.
You can find that X is not Hausdorff (things go wrong at the two origins). And $q\left([-1,1]\times {0}\right)$ is compact (q is continuous) and contained in X.
However it is not closed : $q(0\times 1)$ is a limit point of $q\left([-1,1]\times {0}\right)$ but not contained in $q\left([-1,1]\times {0}\right)$
Remark : To show that X is not Hausdorff, let $U,V\subset X$ be two neighborhoods of $q(0\times 0)$ and $q(0\times 1)$ respectively.
Then $0\times 0\in q^{-1}(U)\subset \mathbb{R}\times \{0,1\}$ and $q^{-1}(U) $ open since the quotient map is continuous.Thus it must contains a basis of the space, say $(-\epsilon,\epsilon)\times 0$; same situation for $q^{-1}(V)$, say $(-\delta,\delta)\times 1$
Let $\eta=\min{(\epsilon,\delta)}$, and observe that $\emptyset\neq q\big((-\eta,\eta)\times 0\big)\cap q\big((-\eta,\eta)\times 1\big)\subset U\cap V$, which shows that X is not Hausdorff.
