There is not a magic age where a child can choose which parent to live with as children are not considered to have a "legal right to choose." An older child will be given more consideration from a judge, but there is no specific age limitations.
Judges have complete freedom whether or not to listen to a child's preference and how they will consider it in the court case. The legal standard in all 50 states is that the judge should choose a living situation that will be in "the best interests of the child." The case is always fact driven and will look at the family's specific situation. This will be much more important than the child's age and the child's preference of who to live with. Some courts will allow the child's preference to carry weight, but it is typically a very small part of the final decision.
In the Michigan Court of Appeals, a statement was made about child custody that read: "A child custody determination is much more difficult and subtle than an arithmetical computation of factors. It is one of the most demanding undertakings of a trial judge, one in which he must not only listen to what is said to him and observe all that happens before him, but a task requiring him to discern and feel the climate and chemistry of the relationships between children and parents."