Pippin Took is the youngest of the four Fellowship Hobbits (which makes it ironic that the actor who plays him in the film of The Fellowship of the Ring, Billy Boyd, is by far the oldest of the main Hobbit actors). In a way, Pippin's youth is his major character trait, since his main job in the novel is to be young and stupid. Pippin brings a sense of humor and lightheartedness to the novel that older characters like Aragorn and Legolas totally lack. Take this standard exchange between Gandalf and Pippin:
"We Hobbits ought to stick together, and we will. I shall go, unless they chain me up. There must be someone with intelligence in the party."
"Then you certainly will not be chosen, Peregrin Took!" said Gandalf. (2.3.5-6)
Pippin has tons of enthusiasm and plenty of loyalty, but he truly has no idea what he is getting into with the Ring Quest. He insists on going along with the Fellowship because he wants adventure and, let's face it, because his older cousins Merry and Frodo are going. Of course, Pippin gets in over his head and makes tons of mistakes. He gets teased and mocked over and over again by the older members of the Fellowship (like Gandalf in this passage). But he never lets himself get too discouraged. Without Pippin, we shudder to think how grim this novel would become.
Of course, Pippin knows that this Ring Quest is not all fun and games. He has his own moments of doubt, when he thinks, "I am no good after all. There is not enough of the breed of Bandobras the Bullroarer in me" (2.4.38). But (a) Pippin is certainly good enough, as he proves by Book Three, and (b) honestly, no one mortal is really good enough for this quest. That's one of the overarching messages of this whole series – the Ring Quest is impossible, and yet somehow, they have to achieve it anyway. (See Frodo's "Character Analysis" for more on this weird contradiction.)
Pippin may not be an experienced warrior like some of his Fellowship-mates. But like Sam, he has a giant heart and lots of courage. And those traits are ultimately useful in fighting back against the despair that Sauron's servants use to attack the good guys. After all, Boromir is a big guy skilled in the manly arts of war and killing Orcs, and he winds up falling for the Ring's temptations. Pippin's happy, careless incompetence seems a lot better than active betrayal by a more obviously "heroic" character.
Don't get us wrong: some of Pippin's screw-ups nearly get the Fellowship killed. The worst example is definitely the one where Pippin throws a stone down a well in the Mines of Moria. The noise draws the attention of the Orcs, Frodo almost gets skewered by a spear in battle, and Gandalf falls in battle with the Balrog of Morgoth. Oops! On the other hand (spoiler alert!), if Gandalf hadn't fallen, we would have no Gandalf the White in The Two Towers. And without Gandalf the White, the whole war effort against Sauron would probably have collapsed before it even got started. Maybe we should be thanking Pippin for the Moria disaster?