Does there exist a topology for a set $X$ which is compact and Hausdorff?

If $X$ is finite, then the discrete topology is Hausdorff compact and we're done.

If $X$ is infinite, fix some $x\in X$, and let $X'=X\setminus\{x\}$ have the discrete topology which is a locally compact topology, and take $X$ to be the one-point compactification of $X'$. That is $x$ is "the point in $\infty$".

Then clearly $X$ is compact, and to see it is Hausdorff, take $u,v\in X$ to be distinct. At most one of them is $x$ itself, if it is the case assume $v=x$. Taking $\{u\}$ and $X\setminus\{u\}$ we have two disjoint open sets and we are done.


Another, in fact much simpler (but using the axiom of choice, whereas the previous one doesn't) example would be the following:

Let $\alpha$ be an ordinal such that $|X|=|\alpha|$, then $\alpha+1$ as an ordinal space is both Hausdorff and compact. To see that it is Hausdorff take $x<y\in\alpha+1$ then $(0,x+1),(x,\alpha)$ as two open intervals witnessing that.

The compactness of successor ordinals follows from the fact that given a cover by open intervals we can index the endpoints of these intervals, and form a decreasing sequence of ordinals. Since every decreasing sequence of ordinals is finite we can find a finite subcover.

From there to the general case of open sets the switch is simple, replace each open set by all the intervals it contains; find a finite subcover; replace each interval in the finite subcover by a particular open set which contains it.