This is basic genetics (re sex ratio) and basic permutations and combinations theory.
Key words: Punnet square, permutations, combinations, independent variable.
Warning - you hit a hot spot, this will be longish. Shades of my second stats lecture, way back when.
Boy/girl baby thing. Technically the odds are not 50:50 (more boys, usually 52:48 but it does vary) in mammals (humans are mammals) in a Population. In an individual, things differ - there are cases where a fetus is rejected (most obvious is Rh incompatibility). But go with simplicity, 50:50, odds for one baby are 50% = 0.5 either sex. Two independent occurrences (i.e. the two women), probability is multiplied, so 0.5x0.5 = 0.25, or 1/4. There is only one way both babies can be girls, so .25. There is only one way both babies can be boys, .25. But there are two ways to get one of each, either Mom A has the boy or Mom B has the boy, so that is .25 + .25 = .50. A Punnett square shows this easily. Mendel did the same for peas.
All this assumes the occurrences are independent. What if you have two genes very close together on the same chromosome? Then they will usually occur together and they are not "independently assorted". If one gene has an abnormal form that we want to know about, the other gene may be used as a marker.
The math is easier to learn with non-living situations, because then you don't get into all the biology that complicates things. Back to dice.
One die has 6 possibilities, right? 1, 2, 3, 4, 5, 6. So the odds of a 1 are 1/6. The odds of any one number are 1/6. The odds of an even number are 1/2 (2, 4, or 6, = 1/6 + 1/6 + 1/6). Same for the odds for an odd number. Two dice - look at odds for each die, then add the two together for two dice. Want a 7? You can have 1+6, 2+5, 3+4, 4+3, 5+2, and 6 + 1. This is easier to visualize if the two dice are two different colours, then you can see if the 1 was a white or red die. We have 6 ways of getting a 7. There are 36 possible combinations, so the odds are 6/36 or 1/6. If you want a 2? There is only one way to get a 2 = 1 + 1. So the odds are 1/36. For an 11, the odds are 2/36 (5+6, 6+5).
And yes, this branch of math started because gamblers wanted to know the odds.