A child custody investigators job is to basically observe the child or children that are in a child custody battle to see how well the child or children are being cared for by the parents.
The child custody investigator observes and investigates the well-being and treatment of the child or children, usually as part of a divorce, separation and then reports that investigation and observation of what they seen back to the court.
The court then decides on who should really get the custody of the child or children based on the child custody investigators observations and reports.
So it's important to do everything right and care for your child properly when in a child custody battle as even just a small slip of something as a parent could cause you to lose your child.
Even then you should always love your child and take care of them properly and never abuse your child or children for any reason anyway.