I'm a newbie in math and also in this StackExchange. I apologize for any mistakes.
The sample space of $n$ coins tossed seems identical to the expanded form of a binomial at the $n$th power.
Let's take the sample space $S$ of a situation with $n=3$ coins tossed.
$$S=\{HHH,\ HHT,\ HTH,\ HTT,\ THH,\ THT,\ TTH,\ TTT\}$$
Now, let's treat $H$ and $T$ as algebraic variables (I don't think it's legal to do that, but let's do it anyway). So, due to commutative properties of multiplication, $HHT=HTH=THH$, etc.
So the new set now looks like this $$S=\{H^3,\ H^2T,\ H^2T,\ HT^2,\ H^2T,\ HT^2,\ HT^2,\ T^3\}$$
Now, let's add up the elements of the set, and we get-
\begin{align} &\quad\ \ H^3\, +\, H^2T\, +\, H^2T\, +\, HT^2\, +\, H^2T\, +\, HT^2\, +\, HT^2\, +\, T^3 \\ &= H^3\, +\, 3H^2T\, +\, 3HT^2\, +\, T^3 \end{align}
-which is the binomial expansion of $(H+T)^3$.
Why does this happen? How are sample space of $n$ tossed coins and the binomial expansion of $(H+T)^n$ related?
The binomial coefficients appear because of the combinatorial aspects of the problem- and the fact that when we look at the number of heads in a set of coin flips, we are treating multiple distinct sequences as identical. The order in which a certain number of heads appears is immaterial, so we sum the (identical) probability for every sequence with a given number of heads.
But a simple algebraic expansion may be more illuminating. If we have the probability of heads $p$ and flip $n$ times (the coin flips are of course independent) then the probability of getting heads or tails on one flip is $p + (1-p) = 1$ and for $n$ independent flips the probability of getting heads or tails for all of them is $(p +(1-p))^n = 1$. That is obviously true, heads and tails encompass the entire set of possibilities...but expand the second expression with the binomial theorem-
$$(p + (1-p))^n = \sum_{k=0}^{n} {n \choose k} p^k (1-p)^{n-k} = 1^n = 1$$
This is what you have discovered exactly, just formalized, with the additional realization that this is just an expansion of 1- we're summing over all possibilities. Replacing $H \to p$ and $T \to 1-p$ makes the fact that you're expanding $1^n$ more clear.
The keys are:
The coin flips are identical and independent
The probability of $n$ independent events is the product of the individual probabilities
The probability of any sequence of heads and tails depends only on the number of heads and tails, not the order (due to multiplication being commutative)
The binomial coefficients count the number of distinct sequences that have $k$ heads in $n$ flips, which counts how many different sequences we group together when we sum the probabilities for a specific number of heads.