Question about counting probabilities I have a question about the answer given by Andre Nicolas in the question below:
A fair coin is tossed until either a head comes up or four tails are obtained.what is the expected no. of tosses?
If the sample space $S = \{H, TH, TTH, TTTH, TTTT\}$ we can't use the formula $P(E) = \frac{|E|}{|S|}$ where $|E|$ is the number of outcomes in the event $E$ because the outcomes of $S$ are not equally likely, correct? So, then how do we calculate the probabilities of elements in $S$? Do we count the probability of $H \in \{H, T\}$, probability of $TH \in \{TH, HT, HH, TT\}$, probability of $TTH \in \{TTH, TTT, HHH, THT, HHT, HTT, HTH, THH\}$ and probability of $TTTT$ in a set with $16$ outcomes? 
 A: 
So, then how do we calculate the probabilities of elements in $S$?

In general you require some model of how the outcomes are generated that will enable you to evaluate their probabilities.   In this case the model is a truncated geometric distribution - you have a sequence of independent Bernoulli events (flips of a fair coin) and are counting trials until success or four failures; with success rate $1/2$.
So letting $X$ be the count of trials until success or four failures.   $\{X=2\}$ corresponds to $\{TH\}$ and so forth.  $$\mathsf P(X=k) = \begin{cases} 2^{-k} & : k\in\{1,2,3\} \\ 2^{-3} & : k=4\\0 & : k\notin\{1,2,3,4\}\end{cases}$$

Do we count the probability of ... in a set with $16$  outcomes? 

Yes, you can!   That is also a valid model.   Consider that if you (hypothetically) tossed the coin four times, you can group the sixteen equally probable outcomes into events by occurrence of the first head.   These events will correspond to those of your sample space, giving you a measure of their probability.
$$S'= \rm \Big\{\{\color{blue}{H}HHH, \color{blue}{H}HHT, \color{blue}{H}HTH, \color{blue}{H}HTT, \color{blue}{H}THH, \color{blue}{H}THT, \color{blue}{H}TTH, \color{blue}{H}TTT\}, \\ \{\color{blue}{TH}HH, \color{blue}{TH}HT, \color{blue}{TH}TH, \color{blue}{TH}TT\}, \\ \{\color{blue}{TTH}H, \color{blue}{TTH}T\},\\ \{\color{blue}{TTTH},\color{blue}{TTTT}\}\Big\}  $$

tl;dr $$S\times\mathsf P = \{{\rm (H, \tfrac 12), (TH, \tfrac 14), (TTH, \tfrac 18), (TTTH \cup TTTT, \tfrac 1{8})}\}$$
$$X\times\mathsf P = \{{\rm (1, \tfrac 12), (2, \tfrac 14), (3, \tfrac 18), (4, \tfrac 1{8})}\}$$
$\mathsf E(X) = \tfrac 12 +\tfrac 2 4+\tfrac 38+\tfrac 48 = \tfrac {15}{8}$
A: If you have outcomes that are not equally likely, then you multiply the probability of that outcome by the outcome's quantity that you're measuring (in this case, number of tosses):
$$\frac{1}{2} \cdot 1 + \frac{1}{4} \cdot 2 + \frac{1}{8} \cdot 3 + \frac{1}{16} \cdot 4 + \frac{1}{16} \cdot 4 = 1 \frac{7}{8},$$
which rounds up to $2$.
