Children cannot decide, as was stated.
However, many judges will let the child be heard to some extent. In many cases, the judge will talk to the child (no set age) and will decide from there. I have a friend where, when she was 4 and her parents were divorcing, the judge took her to chambers and asked her several questions about her parents and such. The judge used this testimony to set the final judgment. Yes, this is a rare case, but the discression is in the hands of the judge. There are no specific laws to allow for such.