Logic riddle: How to calculate the expected intersection at random? (I named this riddle as one does not need any prior knowledge other than basic school math. Yet I am not 100% sure what the answer is.)
According to this illustration that I made:

What is the expected (at random) size of the intersection of sample (a) of pool A and sample (b) of pool B, provided we know the sizes of A, B, a, b, AiB and AuB?
In other words, you have a dice with A sides and another one with B sides, which are known to have AiB sides in common, and you roll dice A until it shows (a) many different outcomes and dice B until it shows (b) many different outcomes, then how many unique outcomes are dice A and B supposed to have in common?
EDIT: I think it is:
(a / A) * (b / B) * (AiB / AuB) * AuB
or
(a / A) * (b / B) * AiB
But I am not sure.
 A: The sample $a\subset A$ corresponds to its indicator function $X: A\cup B\to \{0,1\}$ defined by $X(i)=1$ for $i\in a$ and $X(i)=0$ otherwise.
The indicator function is a tool for working with probabilities.  The connection is through the expectation.  For each $i\in A\cup B,$ $X(i)$ is a random variable.  By the definition of expectation, the expected value of $X(i)$ is
$$E(X(i)) = \Pr(X(i)=0)(0) + \Pr(X(i)=1)(1) = \Pr(X(i)=1) = \Pr(i\in A).$$
A similar indicator function $Y$ is associated with the sample $b.$  You implicitly assume the samples are independent, whence so are all pairs of random variables $X(i)$ and $Y(j).$
Calling a set $a$ a "sample" of $A$ implies every element $i\in A$ has an equal chance $\pi_a = \Pr(i\in a)$ of being in $a$ and no element of $B\setminus A$ has any chance of being in $a.$  With this notation, when $i\in A$
$$E(X(i)) = \pi_a$$
and otherwise $E(X(i)) = 0.$
The number of elements of $a$ can be recovered from its indicator function as
$$|a| = \sum_{i\in A} X(i).$$
Taking expectations gives
$$|a|=E(|a|) = E\left(\sum_{i\in A} X(i)\right) = \sum_{i\in A} E(X(i)) = \sum_{i\in A} \pi_a = |A|\pi_a,$$
allowing us to conclude (supposing $A$ is nonempty) that
$$\pi_a = \frac{|a|}{|A|},\tag{1}$$
as you correctly intuited.  Using a similar notation for the sample $b\subset B$ we conclude
$$\pi_b = \frac{|b|}{|B|}.\tag{2}$$
Finally, the size of the intersection of the samples is
$$|a\cap b| = \sum_{i\in A\cap B} X(i)Y(i).$$
Taking expectations once more and exploiting the independence assumption gives
$$\begin{aligned}
E(|a\cap b|) &= \sum_{i\in A\cap B} E(X(i)Y(i))\\
&= \sum_{i\in A\cap B} E(X(i))\,E(Y(i))\\
&= \sum_{i\in A\cap B} \pi_a\pi_b\\
&= |A\cap B|\pi_a\pi_b.\end{aligned}$$
The answer is found by plugging $(1)$ and $(2)$ in for the probabilities,
$$E(|a\cap b|)  = |A\cap B|\, \frac{|a|}{|A|}\, \frac{|b|}{|B|}.$$
This is the value given in the question.
