Aligning sets with omitted elements

You can set the intercolumn space to zero and provide empty atoms in order to force TeX into adding automatic spacing.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array} % <--- addition!

\begin{document}

An array environment does the alignment well,
\[
\setlength{\arraycolsep}{0pt}
\begin{array}{ r >{{}}c<{{}} r<{\,} *{5}{l<{{}}} }
S & = & \{ & n_1, & n_2, & n_3, & n_4, & \dots\} \\
T & = & \{ &      & n_2, & n_3, & n_4, & \dots\} \\
U & = & \{ &      & n_2, &      & n_4, & \dots\}
\end{array}
\]

\end{document}

After the opening brace I added \, in order to balance the space after the dots at the end.

enter image description here

The intercolumn space can also be suppressed with @{}, but in this application it's easier to set the default space to zero, as the assignment will be local to the math display.

If you remove <{\,} and use \ldots, the output would be

enter image description here

You judge whether you prefer this way.


\phantom measures the so-called natural height/depth/width of things by placing them into a \hbox and measuring that box's dimensions while often TeX does not typeset things at their natural dimensions but shrinks/stretches some glues for having things fit into their surrounding nicely.
Also \hbox implies restricted horizontal mode as starting-point for typesetting/measuring while in TeX there are things whose behavior is not the same for all six possible modes (restricted horizontal mode, horizontal mode, restricted vertical mode, vertical mode, math mode, display math mode).

In your scenario \phantom's placing of things into a \hbox implies intercepting surrounding math-mode by restricted horizontal mode. The horizontal spacing at transitions from math-mode material to restricted-horizontal-mode-material often is different from the horizontal spacing between two things, which are both set in math-mode without triggering a change of the mode in between.
The macro \phantom detects and therefore inside its \hbox switches to the mode which is in effect while it is called. But \phantom does not detect if something at the borders of the empty space it creates is typeset in the detected surrounding mode at all.
So \phantom does not take into account if transitions from math-mode material to restricted-horizontal-mode take place which affect horizontal spacing and which would not take place if the "phantomized" things were not "phantomized" but were just typeset without changes of mode in between.
That's what causes the differences in horizontal spacing in your scenario between lines where some things are "phantomized" and lines where these things are not "phantomized".

In the following example a command \nophantom is provided which typesets/is intended to typeset things under the same conditions under which \phantom measures them.

Note that the example below is not intended as a solution to your problem.

A solution is already provided in egreg's answer and the code provided by egreg provides much better typesetting-results than the example below.

The example below is intended to illustrate the way in which \phantom measures things.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand\nophantom[1]{%
  \begingroup\def\finph@nt{\box\z@}\phantom{#1}\endgroup
}%
\makeatother

\begin{document}
An align environment with \verb|\phantom| and \verb|\nophantom| where consecutive terms and commas are aligned:
\begin{align*}
S & = \{\,\nophantom{n_1,{}}\nophantom{n_2,{}}\nophantom{n_3,{}}\nophantom{n_4,{}}\ldots{}\},\\
T & = \{\,\phantom{n_1,{}}\nophantom{n_2,{}}\nophantom{n_3,{}}\nophantom{n_4,{}}\ldots{}\},\\
U & = \{\,\phantom{n_1,{}}\nophantom{n_2,{}}\phantom{n_3,{}}\nophantom{n_4,{}}\ldots{}\},
\end{align*}

It is intended only to illustraste how \verb|\phantom|'s measuring works. E.g., getting some spacing behind commas via \verb|{}| is not funny at all with this approach.

\end{document}

enter image description here