The parent must draft and file a motion or complaint with the court. The issue is usually sent to something called "custody mediation" first- this is where a mediator tries to get the parents to behave reasonably and work out the issues. Then it goes to the judge to decide any remaining issues. This is done to save valuable judge's time. Parents are also required to take a mandatory parental education class in the county where the case is pending.
How does a judge figure out which parent gets custody?
The main standard for child custody cases is "what are the best interests of the children?" Since children usually do better when both parents are involved in their lives, the judges prefer joint custody arrangements. The court decides which parent gets greater rights by establishing which parent is the parent of primary residence. The other parent is a parent of alternate residence and has part-time custody. First, the parents try to work out a schedule for custody on their own, but the court can appoint a mediator or other party to do a home study, interview the kids and parents and then make a formal recommendation to the court on custody, that the court can turn into a court order.