This is the most important — and may be the most difficult — thing you will have to do when you decide to divorce. If you can (and emotional and logistic circumstances may prevent this), try to tell the kids about the divorce together. Also, try to tell them as soon as possible. Past the age of 5, I think children are quicker than parents at recognizing emotional clues, and once they are emotionally vigilant they can overhear way more than you would expect.
Talk through with the other parent just what you need to say to the kids. Almost all libraries have a good selection of how-to books on telling your children that their parents are going to divorce.
Children of different ages have different responses to divorce; the way you tell them should be coordinated to the developmental ages of your children. I have long thought that the younger a child is, the less stress he or she feels at divorce. I believe, and the data bears this out, that adults and young adults are often the most psychologically stricken by their parents’ divorce. They also are vulnerable to being treated as a confidant, sometimes by both parents. It may be very hard to do this, but adult and young adult children should not be dragged into the process any more than younger children.
Always remember that the kids are the most vulnerable parties in a divorce. How you and your spouse handle this, and the years of co-parenting to come, is as important as anything you do as a parent.