So a man learns that he is about to be frivorced. What should he do? Since it is a frivorce, reconciliation does not make sense. He should realize that the situation is now contest, he should be calm and resolute, and not take things personally. For the drama is about to begin.
First, lawyer up. Find a good one. Realize that most every conceivable accusation can and will be thrown at you. Be ready for it. If there are children involved, she will use them as pawns, and try to leverage them to her benefit; even to their detriment. You must be ready for this and counter it.
If you want the greatest feasible parental rights with your children, you need to be (and maintain) a squeaky clean situation. This would include a good job, no brushes with the law, a fine home. etc. The father is always held to a higher standard with respect to these things.
When you do gain parental rights (e.g. weekends), make sure that the children see only the best of you. Don’t be drunk, don’t be swearing, keep the place clean, etc. You want the kids to be able to tell the truth to officials about the situation at your place.
The ex will probably try to bait you into doing something foolish. Don’t fall for it. Keep your cool. Realize that this is what she is trying to do.
This really becomes a game of chess. One needs to think several moves ahead.
I am sure that commenters have other tips.
As usual, NAWALT applies