The history of custody law traces one of the biggest social transformations of the past century. In America nearly a third of children see their parents divorce before they turn 18. The share of American children living in single-parent divorced households is almost five times higher than it was in 1960. In Britain nearly a quarter of children live with single parents, though far fewer adults are divorced, because they are more likely to have children without marrying first.
For most of history the law treated children as property—the father's. In 19th-century England a single mother had the right to keep her children only if they were illegitimate. The Custody of Infants Act of 1839, championed by Caroline Norton, was the first feminist law in British history, giving mothers the right to petition for care of young children.
After that, a "tender years" doctrine took hold, with the view that young children need a mother's care—though this did not extend to transgressive or adulterous women. In the 1970s a fathers' rights movement gained force, arguing it was unfair that custody was awarded to mothers by default, leading judges to consider more strongly the best interests of the child.
More recently, claims of "parental alienation" have played a role in custody proceedings, with one parent (usually the father) claiming a child is being manipulated into estrangement by the other. One study found that if a father cross-claims alienation, courts are nearly four times more likely to disbelieve a mother's assertion of child abuse.
Remember, even if you win the rat race -- you're still a rat.