What is the probability of a given bit after a shuffle? Let $S = \{b_1, b_2 ,...,b_n\}$ be a sequence of bits of size $n$, $b_i \in \{0, 1\}$
Let $f$ be a simple shuffling algorithm (you can consider Fisher–Yates as an example).
We have $$f(S) = S^{\prime} = \{b_1^{\prime}, b_2^{\prime} ,...,b_n^{\prime}\}$$
What is the probability that $$b_i^{\prime} = b_i ~|~ i \in [n]$$

Example:
If $[0, 1, 1, 0] \rightarrow [0, 0, 1, 1]$ ... What is the probability that the last bit "$1$" that I observe here after shuffling is true in the original sequence before shuffling?
The last bit here is just an example. It can be any bit.
 A: I'm not sure I fully understood the question, but the Python code in the provided link randomly samples an integer strictly between the current bit and the last (including) for swapping, except the first swap, which happens w.p.$1$.
I think I got a solution for a simpler problem, but you should be able to extend it to yours. Let's assume the last two bits in $S$ are $11$, so after the first swap you still got $1$. You can condition on the total number of swaps with the last bit. Two first two cases are no swaps and exactly one swap. If there were no swaps, $P(S_n =1|no \ swaps)=1$ and the probability of no swaps is $\frac{1}{n-1}$. For the second case, if we don't know anything about the values of bits in the positions in $S$, let $\sigma$ be the share of $1$ in $S$, then $P(S_n =1|1 \ swap)=\sigma$, the value of bit in that specific location. The probability of exactly one swap is
\begin{align}
P(swap) &= \frac{1}{n-1} + \frac{1}{2}\times \frac{1}{n-1} + \frac{1}{3}\times \frac{1}{n-1} + \ldots \\&= \frac{1}{n-1} \bigg(1+\frac{1}{2}+ \ldots + \frac{1}{n-2}\bigg) \approx\frac{\log(n-2)}{n-1}
\end{align}
A: It seems like you are just talking about random permutations, and the particular shuffling algorithm makes no difference.  If so, then the probability that a given bit ends up in a particular position is the same for all bits.  If there are $n$ $1$-bits and $m$ $0$-bits, then the probability that the bit in a given position is $1$ after the shuffle is $\frac n{n+m}$.  On the other hand the probability that a position selected at random before the shuffle has a $1$ in it is also $\frac n{n+m}$, and since the events are independent, the probability that the position contains $1$ both before and after the shuffle is $\frac{n^2}{(n+m)^2}$.  Similarly, the probability that a random position contains $0$ both times is $\frac{m^2}{(n+m)^2}$, so the probability that it contains the same number both times is $$\frac{n^2+m^2}{(n+m)^2}$$.
