As you may already know, Harper Lee based the character of Dill on her old childhood friend, Truman Persons, who later became known in the literary world as Truman Capote. Capote, like Dill, stayed summers next door to Lee in her hometown of Monroeville, Alabama (the town that Maycomb is based upon). There are many parallels between the two characters. Both Capote and Dill are small and come from broken homes--loners with vivid imaginations. Capote began writing at an early age, and Dill comes to Maycomb armed with many wild tales that thrill both Jem and Scout. Dill serves as Scout's first love, and his curiosity about Boo Radley spurs the other children's interest in getting a peek at the mysterious phantom. Dill also serves as one of the book's human mockingbirds, an innocent child who is neglected by his parents and is forced to endure emotional distress at an early age. Dill is clearly more upset at some of the events he witnesses than the Finch children. He decides that Boo must stay inside his house because it is a safer haven than the outside world. He leaves the courthouse in tears because of Tom Robinson's treatment at the hands of the prosecutor. Dill, like Dolphus Raymond, has seen his share of hell in the world, so he decides that he will become a clown one day,
"... a new kind of clown. I'm gonna stand in the middle of the ring and laugh at the folks."
The children first come to know Dill as the character who lives next door sometimes, and is worth learning about. In this regard, Dill helps represent the microcosm of society that groups of young children can be. In all societies, those who are lesser in some way, try to work up to being something more. Dill portrays this as he is significantly shorter than Jem and is trying to prove that he is something more. In my opinion, this is why he feels the need to lie. It is the way he compensates for being shipped around from relative to relative.
This same effort comes from Mayella Ewell in her effort to grow flowers, it comes from Bob Ewell in his effort to sue a Negro just to clear his own name from possible suspicion regarding his daughter's injuries, and we see it in the woman at Calpurnia's church who tries to push her weight around when some white children attend her church. People compensate for their perceived weaknesses.
Another contribution Dill brings to the story is the innocence of a child. His illness in the courtroom helps us see beyond the Finch children who are somewhat immune to courtroom banter that can be hurtful to a human of another race. Dill's innocence will not allow him to yet see color like an adult. Jem and Scout are not racist, but they understand Mr. Glimer's ways. Without Dill, readers would have had no need for Mr. Dolphus Raymond's explanation of the way he lives in chapter 20.