Feste the Clown is Olivia's licensed fool, which means he literally has a license to say whatever he wants. (Bet you'd like to know where you can get your hands on one of those.) Feste's job is to entertain by singing, dancing, cracking jokes, and bagging on everyone around him. As literary critics often point out, he seems to embody the spirit of Twelfth Night festivities, which are all about having a good time and flipping the bird to authority figures. (Check out "What's Up with the Title?" for more on this.)
Feste is a genius with words and has a knack for punning, word play, and witty repartee, which he puts to use throughout Twelfth Night. As "Cesario" points out, even though Feste is a "fool," he's the wisest cat in Illyria:
This fellow is wise enough to play the fool;
And to do that well craves a kind of wit: (3.1.14)
Feste's penchant for accurately sizing up situations and other characters puts him in a position to point out the folly of those around him, while earning a laugh and a couple of bucks at the same time. He points out that Olivia's excessive mourning is over-indulgent and "foolish" and notes Duke Orsino's extreme moodiness when he compares Orsino's mind to an "opal" that changes color. Even while he clowns around with the rowdy Sir Toby, he also provides some shrewd commentary about Toby's excessive and dangerous behavior.
So what? Well, this seems to place Feste both inside and outside the play. He's very much a part of Twelfth Night's rowdy activity, but he's also able to stand outside the world of Illyria, looking in. In this way, Feste seems to break down the barrier between the audience and the characters on stage.