When considering where your child will live and how you'll co-parent with your child's other parent, always consider what's in your child's best interest. That's also what a court will consider. Not every divorce will require a judge to review factors for a child's well-being but some will. When a court does get involved, a judge will look at several factors:
Both parents' ability to provide a stable, loving, and financially supportive home
The relationship the child has with both parents
Both parents willingness to continue their relationship with their child
Where the child has lived
The child's preference, if they are old enough to state one