Suppose $Z$ is a bernouli variable with parameter $p$. $Z,X,Y$ are independent random variables. Now $U$ be a random variable such that
$$U(\omega)=\begin{cases}X(\omega) & \text{when }Z(\omega)=1\\ Y(\omega) & \text{when }Z(\omega)=0\end{cases}$$
From this can we say that
$f_U(t)=f_{X,Z}(t,1)+f_{Y,Z}(t,0)$
Assuming that $X$ and $Y$ have densities $f_X$ and $f_Y$ we can compute $f_U$ as follows:
$$P(U \leq t)=P(X\leq t, Z=1) +P(Y\leq t, Z=0)$$ $$=pP(X\leq t)+(1-p)P(Y\leq t).$$ Differentiating this we get $f_U(t)=pf_X(t)+(1-p)f_Y(t)$ almost everywhere (w.r.t. Lebesgue measure).