If $X$ is a Hausdorff space and $A\subset X$ is compact then $A$ is closed in $X$.
Proof: Suppose $A \neq \emptyset,X$ Let $x\notin A$ We want to find an open $U$ so that $x\in U$ and $ U\cap A=\emptyset$. For every $a\in A$ applying the Hausdorff property on x,a we will have two open disjoint sets $U_a$, $V_a$ so that $x\in U_a$ and $a\in V_a$. Taking all the open sets $V_a$ for $a\in A$, we will have a cover of $A$. Because $A$ is compact, this cover will have a finite subcover $A\subset V_{a_1}\cup...\cup V_{a_n} $. Therefore the open $U:= U_{a_1}\cap...\cap U_{a_n}$ is the open subset that we wanted.
I don't undersand why finding an open $U$ so that $x\in U$ and $ U\cap A=\emptyset$ proves that $A$ is closed in $X$.
To say $A$ is closed is to say $X \setminus A$ is open. You're starting with an arbitrary point $x \in X \setminus A$, and finding an open set $U_x$ that contains $x$, but fails to intersect $A$. In other words, $$x \subseteq U_x \subseteq X \setminus A.$$ Around every point in the set $X \setminus A$, you've found an open neighbourhood in $X \setminus A$.
This implies $X \setminus A$ is open, and hence $A$ is closed. Why? Consider the set $$B = \bigcup_{x \in X \setminus A} U_x.$$ Note that, if $x \in X \setminus A$, then $x \in U_x$, hence $x \in B$, so $$X \setminus A \subseteq B.$$ On the other hand, each $U_x \subseteq X \setminus A$, so $B \subseteq X \setminus A$. Hence, $$X \setminus A = B.$$ This means $X \setminus A$ is a union of open sets, which is therefore open.