Once a child reaches a certain age their opinion is taken into consideration more but whilst the child is relatively young - say primary school age - whoever is best able to care for the child will have primary custody. So if the dad works away then it makes sense for the mother to have custody the bulk of the time. Likewise, if the dad lived much closer to the school the child attends and living with the mother full time meant the child would have to change school, it's more likely the dad would get custody in the week at least. Whichever option results in less disruption to the child's daily life is normally chosen.
But once the child gets older, they have more of a say in where they spend their time.