The court Jester is always the smart/conniving one in fiction. Is this based on any truth?
Yes jesters were real (at least in Medieval England) people. A jester, also known as a fool, was basically a medieval variety entertainer. Typically they would serve in the household of a nobleman and it would be his responsibility to entertain the nobleman and his guests. Jesters also performed for normal townsfolk at markets and fairs. Entertainment typically consisted of dance, music, story telling, reciting poetry, physical comedy and what we today would consider circus tricks. They became a staple part of the royal court during the reign of Edward II and lasted until Charles II (post Restoration) when professional music halls and playhouses took over.
Just like any member of a medieval court, the jester had to be careful of medieval politics. However their role allowed them significant freedom. Jesters who were loyal, entertaining and didn't push the limits were rewarded greatly for their service with land and gifts. If jesters went over the top, made jest of the wrong people etc., then they would be removed from service. Some jesters had very strong relationships with their employer. Jesters for example were sometimes deemed the only people necessary of delivering particularly bad news.
During the late periods the role of jester began to blur. They typically would not live in the court and would also perform on stage, sometimes only performing for nobles on rare special occasions.