My speculation about the appearance of complex numbers is that Mathematica uses the pdf of 1/(1/s+1/t)
which contains logs:
dist = TransformedDistribution[1/(1/s + 1/t), {t \[Distributed] UniformDistribution[{-1, 1}],
s \[Distributed] UniformDistribution[{-1, 1}]}];
pdf = PDF[dist, st] // FullSimplify

Because that random variable can take negative values and there are logs in the pdf, the internal code finds complex numbers even though those complex numbers will eventually "cancel out" outside of that internal code.
So a brute force approach to get the correct result is to do the numerical integeration:
numerator = NIntegrate[r (1/2) (1/2) pdf, {r, -1, 1}, {st, -1, r}, {p, -1, st}]
(* 0.0901967 *)
denominator = NIntegrate[(1/2) (1/2) pdf, {r, -1, 1}, {st, -1, r}, {p, -1, st}]
(* 0.180393 *)
conditionalMean = numerator/denominator
(* 0.5 *)
If one has a few minutes of patience, then Integrate
also works:
numerator = Integrate[r (1/2) (1/2) pdf, {r, -1, 1}, {st, -1, r}, {p, -1, st}] // FullSimplify
(* 1/64 (3 + Log[16]) *)
denominator = Integrate[(1/2) (1/2) pdf, {r, -1, 1}, {st, -1, r}, {p, -1, st}] // FullSimplify
(* 1/32 (3 + Log[16]) *)
conditionalMean = numerator/denominator
(* 1/2 *)
Note: If Log[(-1 + st)/st]
isn't split into two terms Log[-1 + st] - Log[st]
, then the imaginary numbers are not an issue. This condition happens when st < -1/2
.