Mediation gives you and your spouse a chance to work on your divorce agreement in a controlled setting where you make your own decisions. This can help keep your case out of court, where a judge will make a ruling. While trial cases are sometimes helpful, they do turn that control over to the judge, and you then have to follow the court order. With mediation, you can retain control and find the appropriate solution -- within the bounds of the law, of course -- along with your ex.
Naturally, though, this means that you and your ex have no choice but to get along and work together. That's not always so easy. You're in the midst of a rather emotional situation. You may not be on the best of terms. One of you may feel angry about the divorce. It's complicated.