Expected value of fraction of heads in n independent tosses with non-zero probability of filtering the outcome Imagine an experiment of tossing $n$ identical coins. The probability of observing a head is $p$ and of observing a tail is $1-p$ for any coin. 
We are interested in calculating the expected value of the fraction of tosses that show heads. 
This is easy because the expected number of heads is $np$ and the total number of tosses is a constant i.e. $n$. So, the expected value of the fraction of tosses with heads is $\frac{np}{n} = p$.
Now, there is a twist. The twist is that if a toss shows tail, then it is always considered part of the experiment but if it shows head, then it is considered part of the experiment with probability $q$. In other words, the denominator in the fraction is not a constant $n$ anymore. I know that we can easily calculate the expected value of numerator and denominator separately but that won't give the expected value of the ratio of the two. How can we solve it ?
Please note the difference from a simpler question in which only the count of heads decreases by a factor of $q$ but not the total number of tosses that are considered in the experiment.
 A: Let $X$ be the count of heads, and $Y$ the count of heads "in the experiment", among $n$ trials.
You seek $\tfrac 1n\mathsf E(Y)$.

We know $X$ follows a binomuial distribution.   Well, likewise the count of heads "in the experiment", under the condition that $X$ heads show, will be Binomially distributed too. $$\begin{split}X&\sim\mathcal{Bin}(n,p)\\Y\mid X&\sim\mathcal {Bin}(X, q)\end{split}$$
The relation expectation of a Binomial distributed random variable is well known.   You have stated it.   $\mathsf E(X)=np$.   So similarly $\mathsf E(Y\mid X)=Xq$.
Then it is just a matter of applying the Law of Total Probability: $\mathsf E(Y)=\mathsf E(\mathsf E(Y\mid X))$.
That is all.

Alternatively: You are conducting $n$ independent trials where a success occurs with probability $pq$, since a success is: a head shows and is considered "in the experiment".   Then the count of heads "in the experiment" among the $n$ trials is binomially distributed: $Y\sim\mathcal{Bin}(n, pq)$.   What is its expectation?

Edit: It seems what you seek is $\mathsf E(\tfrac Y M)$ where $M$ is the count of tosses "in the experiment."  $M=n-X+Y$
Well, we know that the counts of tails, heads-in, and heads-out will be multinomially distributed, $(n-X,Y,X-Y)\sim\mathcal{Multinom}(n; 1-p,pq,p-pq))$
A little thought tells us that $Y\mid M\sim\mathcal{Binom}(M, \rho)$ for some $\rho$ .
And so $\mathsf E(Y\mid M)= M\rho$ and $\mathsf E(\tfrac Y M)=\mathsf E(\tfrac {\mathsf E(Y\mid M)} M)= \rho$
Identify $\rho$ and you are done.

 $Y$ is the count of heads among the $M$ coin-tosses that we don't ignore. $\rho$ is the condtional probability that a particular coin toss is a head, when given that it is not ignored.

