Here is a question that I have had in my head for a little while and was recently reminded of.

Let $X$ be a (nonempty!) topological space. What are useful (or even nontrivial) sufficient conditions for $X$ to admit a group law compatible with its topology?

There are many necessary conditions: for instance $X$ must be completely regular. In particular, if it is a Kolmogorov space it must be a Urysohn space. It must be homogeneous in the sense that the self-homeomorphism group $\operatorname{Aut}(X)$ acts transitively. In particular $\operatorname{Aut}(X)$ must act transitively on the connected components of $X$.

It is rather clear though that these conditions are nowhere near sufficient even for very nice topological spaces. A recent question on this site calls attention to this: even for the class of smooth manifolds there are a sequence of successively more intricate necessary conditions but (apparently) no good sufficient conditions.

What about for other classes of spaces? Here are two examples: it suffices for $X$ to be discrete (i.e., every set is open) or indiscrete (i.e., only $\varnothing$ and $X$ are open). These are, of course, completely trivial. Can anyone do any better than this? For instance:

If $X$ is totally disconnected and compact (for me this implies Hausdorff), must it admit the structure of a topological group?

**Added**: as some have rightly pointed out, the above necessary condition of homogeneity is not implied by my assumptions. So let us assume this as well. Note that assuming second-countability as well forces the space to be (finite and discrete or) homeomorphic to the Cantor set, which is well-known to carry a topological group structure, so I don't want to assume that.