Of particular interest are Hausdorff compactifications, i.e., compactifications in which the compact space is Hausdorff. A topological space has a Hausdorff compactification if and only if it is Tychonoff. Moreover, there is a unique (up to homeomorphism) "most general" compactification, the Stone-Čech compactification of X, denoted by βX. The space βX is characterized by the universal property that any continuous function from X to a compact Hausdorff space K can be extended to a continuous function from βX to K in a unique way.
For any non-compact space X the (Alexandroff) one-point compactification of X is obtained by adding an extra point ∞ (often called a point at infinity) and defining the open sets of the new space to be the open sets of X together with the sets of the form G U {∞}, where G is an open subset of X and X \\ G is compact. The one-point compactification of X is Hausdorff if and only if X is Hausdorff and locally compact.
In the study of discrete subgroups of Lie groups, the quotient space of cosets is often a candidate for more subtle compactification to preserve structure at a richer level than just topological.
For example modular curves are compactified by the addition of single points for each cusp, making them Riemann surfaces (and so, since they are compact, algebraic curves). Here the cusps are there for a good reason: the curves parametrize a space of lattices, and those lattices can degenerate ('go off to infinity'), often in a number of ways (taking into account some auxiliary structure of level). The cusps stand in for those different 'directions to infinity'.
That is all for lattices in the plane. In n-dimensional Euclidean space the same questions can be posed, for example about GLn(R)/GLn(Z). This is harder to compactify. There is a general theory, the Borel-Serre compactification, that is now applied.
In string theory, compactification refers to "curling" up the extra dimensions (six in the superstring theory) usually on Calabi-Yau spaces or on orbifolds.