For the current to pass the first switch (that is the point midway between A and B), switch 1, 2 or both should be closed.
Hence, the probability becomes P(1 close, 2 open) + P(2 close, 1 open) + P(1 and 2 close) = p(1-p) + p(1-p) + p^2
Same thing for the current to pass through the second switch.
So, the total probability is when both events occur, or: P(pass 1st) x P(pass 2nd) = [p(1-p) + p(1-p) + p^2][p(1-p) + p(1-p) + p^2]
Try out the others?
EDIT: This simplifies to: