One of the most primal instincts for parents is to protect their children. This is the case when there is a divorce. You want to keep them protected throughout the process. There are a variety of ways that this can happen, but the most important to remember is that you keep the focus on them.
You have to remember that children aren't just miniature adults. They don't have the emotional coping skills or understanding that adults have, so they won't be able to handle things in the same way as an adult would. It is imperative that you find age-appropriate ways to help them work through this.
As you and your ex work out the details of the custody arrangements, you need to be sure that you aren't adding to the stress the children feel. They are watching you to see how you handle the situation and will take their cues from you about how they are going to react to specific things. It is almost always best for them to see you and your ex working as a team.
You also have to watch the kids to see if there are any situations that are leading to them have negative feelings or behaviors. This can be something as innocent as saying they have a headache or as serious as them acting out at school. When you notice abnormal behaviors, you should do your best to address those right away.
It might help if you aren't trying to do this on your own. You can enlist your child's teachers and other trusted adults who can help them to work through their feelings. Sometimes, they just need someone to validate their feelings and help them to find solutions.