Generally, where there is a custody dispute concerning a child 14 years of age or older, the court will appoint a 'law guardian', who will speak with the child, obtain his or her opinion and express that opinion to the court at a designated time. That preference will be a factor considered by the court in determining custody.
There is no magic age when children get to decide custody. The best interest of the child is the standard.
The law regarding a child's 'right'* to choose is a matter for each State and jurisdiction. The judge in most States, not the child, makes the decision based on the best interest of the child. Although not a standard by any means, many States have begun to give 'consideration' to a child's declaration of custodial preference when the child reaches the age of twelve or thirteen, sometimes fourteen. There are even cases when children of age 9 are allowed to testify.
The judge is normally given almost unlimited latitude in whether or not she or he listens to a child and how much weight to give to the child's wishes. In short, there is no specific "age" but the younger the child the less likely for a judge to give the stated preference much weight.
Good luck to you.
NOTE: This answer is made available by the out-of-state lawyer for educational purposes only. By using or participating in this site you understand that there is no attorney client privilege between you and the attorney responding.