How is child custody determined?

If the parties are unable to agree on their custody arrangement then the court will make that determination.  There are a myriad of factors the court considers, including income, emotional stability, drug or alcohol abuse, primary caretaker during the marriage, and many other factors.  The overriding consideration for the court is to decide what is in the best interest of the child(ren).