3ventic and Jupotter already made good answers, so I will just try to elaborate on some things not already mentioned.
- A guardian will try to give the child the same traits they themselves possess, and discourage traits that oppose their own. For example, a kind guardian is unlikely to pass the cruel trait to a child. Use this to minimize bad traits in your realm.
- Greagarious mentors are more likely to influence the child. This includes culture, so use this if the child has the wrong culture. Shy has the opposite effect.
- A guardian with good base stats is generally a better teacher. As a bonus, they often also have good personal traits and a good education trait.
- You generally want courtiers/vassals with varied skills (for appointed members of court, future guardians, generals). Look at the childs base stats. If he has a good starting score in Stewardship, maybe try to assign him to a mentor with a level 3 or 4 in this. Remember, that one day he himself might become a good guardian, so a good education is vital.
Educating your heir
Most of the time, you want to educate your heir, so you can pick some good traits. However, if you've got a rubbish education and garbage stats, you might instead opt for a better suited mentor. Look for people who have a good education, good stats and good traits. Some traits give an opinion bonus to all future vassals. They generally like people who are dilligent, kind, just, brave etc., so look for mentors with those skills, and avoid people with negative opinion traits (e.g. cruel, slothful).
Educating your non-heir offspring
People see it as an honour to be allowed to mentor people in direct line to the throne. If you let a vassal mentor your child, they will get a +20 opinion modifier to you. If you have a surplus of children, this is one way to boost peoples opinion of you. Generally I like to educate my sons, in case accidents happen to my immediate heir (they seem to be slightly prone to this for some weird reason!), but it's up to you. Some players even deliberately give children with strong claims rubbish educations, so they end up being a weaker threat to your favourite heir.
Educating your future vassals
If you want to succeed in CK, you need vassals that don't plot and rebel against you. The great thing about mentoring, is that the child gets a whooping +25 opinion bonus to their guardian. If you're a king, it would be smart to educate the heirs of your most powerful duke yourself – it's not always possible, but it's easy brownie points. In that case, you don't always want to choose the "best" traits, but the traits that most suit your own.
For example, if you have the arbitrary trait, you don't want to teach him to be just, because that will give him a -10 opinion to you.
Also, try to avoid giving your vassals dope stats in intrigue, as that just makes them more capable of plotting against you. Your spymaster shouldn't have any titles or claims that matter in your grand scheme.
IMPORTANT: You never want a direct vassal to be ambitious, because although it gives the character some kickass stats, it may also give them a -50 opinion to their liege (that's you!), if they have some kind of claim (de jure or otherwise) to your titles, plus they are more likely to plot against you. Try to match them with a content mentor instead (+50 opinion to liege). Ideally, the only ambitious character in your realm are you and your heir apparent. Everybody else should be super content and chill with you being the boss. I simply don't let ambitious people mentor anyone, and never if the child has any kind of claim.