Courts consider many factors, such as the child's relationship with each parent, each parent's ability to provide for the child's needs, the child's preference (if they are old enough), and more.