TITLE: Expected value of size of subset
QUESTION [11 upvotes]: Given a set $S$ such that $|S|=n$,
A random item is chosen randomly from $S$, and being appended to a new set $T$.
This process is being repeated $n$ times (with repetition), what is the expected value of $|T|$ ?

REPLY [2 votes]: We can count the number of arrangements of $n$ items picked from a pool of $n$ items that have $d$ distinct items.
Let $S(i)$ be the collection of arrangements missing item $i$. Let $N(j)$ be the sum of the sizes of all intersections of $j$ of the $S(i)$.
Since we can choose $\binom{n}{j}$ items to leave out and for each of those choices there are $(n-j)^n$ arrangements of those items, we have
$$
N(j)=\binom{n}{j}(n-j)^n\tag{1}
$$
Since the number of arrangements with $d$ distinct items is the number of arrangements missing exactly $n-d$ items, according to the Generalized Inclusion-Exclusion Principle, the number of arrangements with exactly $d$ distinct items is
$$
\sum_{j=n-d}^n(-1)^{j-n+d}\binom{j}{n-d}N(j)
=\sum_{j=n-d}^n(-1)^{j-n+d}\binom{j}{n-d}\binom{n}{j}(n-j)^n\tag{2}
$$
To get the total number of arrangements, sum $(2)$ in $d$:
$$
\begin{align}
\sum_{d=0}^n\sum_{j=n-d}^n(-1)^{j-n+d}\binom{j}{n-d}\binom{n}{j}(n-j)^n
&=\sum_{j=0}^n\sum_{d=n-j}^n(-1)^{j-n+d}\binom{j}{n-d}\binom{n}{j}(n-j)^n\\
&=\sum_{j=0}^n[j=0]\binom{n}{j}(n-j)^n\\[9pt]
&=n^n\tag{3}
\end{align}
$$
as expected.
To get the total number of arrangements times their size, multiply by $d$ and sum in $d$:
$$
\begin{align}
\sum_{d=0}^n\sum_{j=n-d}^n(-1)^{j-n+d}\binom{j}{n-d}\binom{n}{j}(n-j)^nd
&=\sum_{j=0}^n\sum_{d=n-j}^n(-1)^{j-n+d}\color{#00A000}{\binom{j}{n-d}}\binom{n}{j}(n-j)^n(\color{#C00000}{n}-\color{#00A000}{(n-d)})\\
&=\color{#C00000}{n\,n^n}-\sum_{j=0}^n\sum_{d=n-j}^n(-1)^{j-n+d}\color{#00A000}{\binom{j-1}{n-d-1}}\binom{n}{j}(n-j)^n\color{#00A000}{j}\\
&=n\,n^n-\sum_{j=0}^n[j=1]\binom{n}{j}(n-j)^nj\\[9pt]
&=n\,n^n-n(n-1)^n\tag{4}
\end{align}
$$
Therefore, the expected number of distinct items picked would be
$$
n\left[1-\left(1-\frac1n\right)^n\right]\sim n\left(1-\frac1e\right)\tag{5}
$$