What conditions are required on a compactification so that it preserves the algebraic structure of a set? My doubt emerged when I reviewed this question after studying compactification from Munkres' defined as the following:

A compactification of a space $X$ is a compact Hausdorff space $Y$ containing $X$ as a subspace such that $\overline{X}=Y$. Two compactifications $Y_1$ and $Y_2$ of $X$ are said to be equivalent if there is a homeomorphism $h: Y_1 \to Y_2$ such that $h(x)=x$ for every $x \in X$.

Suppose we have a naked set $S$ and turn it into a group/ring/ field/ vector space by adding the required operations and also give a topology on it. Then what would be the additional conditions required such that a given compactification of $S$ preserves the algebraic structure?
That is, the algebraic operation such as adding, multiplying, scaling etc makes sense in the compactified space as well?
 A: I'm not aware of anything useful that can be said in this level of generality; algebraic compactifications are very delicate. Generally speaking, in the same way that the Stone-Cech compactification is the left adjoint of the forgetful functor from compact Hausdorff topological spaces to topological spaces, you can ask whether similar left adjoints exist to the forgetful functors from compact Hausdorff [blah] to topological (or even just discrete) [blah]. These aren't guaranteed to produce embeddings but if they aren't embeddings then no embedding exists.
For groups this left adjoint exists and is called Bohr compactification, although it fails to be an embedding for many topological groups; e.g. if a group has no nontrivial finite-dimensional unitary representations then its Bohr compactification is trivial, and such groups exist. We can also take the profinite completion for discrete groups, but again many groups don't embed in their profinite completion or even have trivial profinite completion.
For vector spaces the situation is difficult; there are no nonzero compact Hausdorff vector spaces over $\mathbb{R}$ (if we require that scalar multiplication is continuous). For example, any finite-dimensional subspace of a Hausdorff topological vector space $V$ is closed, so if $V$ is compact then every finite-dimensional subspace must also be compact, but if scalar multiplication is continuous then these subspaces have the Euclidean topology, which is not compact.
There is a construction on vector spaces which is analogous to the Stone-Cech compactification of a discrete space, though; it's given by taking the double dual $V \mapsto (V^{\ast})^{\ast}$, which is naturally a profinite vector space (a pro-object in finite-dimensional vector spaces; strictly speaking this should be "pro-finite-dimensional" but this feels clunky to me), and I believe but have not checked that it's the left adjoint of the forgetful functor from profinite vector spaces to vector spaces; there's some discussion at the nCafe where these things are called linearly compact vector spaces. We recover literal compactness by considering vector spaces over finite fields $\mathbb{F}_q$ but not otherwise.
For rings something funny happens: every compact Hausdorff ring is profinite, and here I really mean profinite in the sense of being a pro-object in finite rings. So the left adjoint of the forgetful functor from compact Hausdorff rings to discrete rings (I don't know what happens for general topological rings) should be given by taking the profinite completion, namely the limit over all finite quotients $R/I$. Many rings don't have any finite quotients so this will be zero fairly often but, for example, for $\mathbb{Z}$ we'll get the profinite integers.
The above result implies that the only compact Hausdorff fields are the finite fields, so the forgetful functor from compact Hausdorff fields to fields doesn't have a left adjoint at all.
