Olaf's Role in Frozen
Although Olaf may seem more as a sidekick or character of comic relief when you first see or watch Frozen, if you watch it several times (like I have), you can realize that there is a lot of depth to Olaf's character, even if he has only a few lines whenever he is seen on screen. Even still, Olaf's name is a clue to his purpose in providing comic relief; it can be interpreted to mean, and even sounds much like, "oh laugh." XD
For starters, Elsa is Olaf's creator and builder. Because of this, parts of her personality became part of Olaf when he came to life. His catchphrase is the very same one Elsa would make him say when she and Anna built him as children, which is "Hi, I'm Olaf, and I like warm hugs." Since he was built during the girls' childhoods (his appearance is the very same as it was as the snowman of that time), this could explain why Olaf has a very naïve and childlike demeanor. Olaf stands for the innermost desire of Elsa's heart, most especially with her longing to be close with Anna again. This is shown perfectly because Olaf loves Anna very much and he tries to protect her the same way that Elsa would have. Elsa has always wanted to be near Anna, but because of her powers, she had to stay away from her. For that reason, Olaf can always be seen around Anna. Even more so, Olaf displays the same feelings as Elsa does in particular scenes. During "In Summer," Olaf sings his desire to experience summer, and it could be interpreted that Elsa is the one who is imagining all of these things. Since she is exposed to the ice from her magic and has been isolated for much of her life, she wants to experience warmth (which would be love, since it is the warmest emotion of all) for a change...and Olaf's line, "And you guys will be there, too," could refer to that Elsa wants Anna with her. When the group was on their way to Hans to save Anna, Olaf humorously asks, "Who is this Hans?!" He was very stunned that Anna's true love is someone who hasn't been mentioned prior to this. Likewise, Elsa was just as shocked when she learned that Anna wanted to marry Hans, but denied her blessing because she believed that Anna couldn't marry someone she just met. Olaf also has the same belief about love as Elsa, in that it means to sacrifice your needs for others. As some of her traits have been ingrained into Olaf, Elsa trying to protect Anna out of love is why Olaf knows what love is. (Similarly, Olaf's puzzlement on how little Anna knows about love is much like when Elsa questions Anna what she knows about true love after getting engaged to Hans when they have only met.) Near the end of the film, they both have the same surprised reaction when they realized that love is the answer to thaw. Olaf is the first to realize that Anna performed an act of love to thaw her heart, and hearing those words make Elsa realizes that love is what will allow her to unfreeze Arendelle.
Although Elsa is his creator, Olaf appears to have traits of both Elsa and Anna. Due to her fear of losing control, Elsa is, or at least appears to be to others, very reserved, calculating, and cold, while Anna is impulsive, social, and energetic. Olaf is made of snow, which is Elsa's element, but he is obsessed with heat and summer, which can be associated with Anna's "hotheadedness" meaning her rash behavior. A couple of scenes also show how he seems to be like Anna, including when he tells Sven, "The sky's awake," much like when at the start, young Anna says, "The sky's awake, so I'm awake." Another example is when he sits down during the scene in the library, he is seen wiggling the small stumps that are his legs, just like when Anna did after Elsa playfully shoved her off her bed. Olaf shows that Elsa can create beauty with her magic, because he also symbolizes what her powers are capable of when she's not letting her fear and insecurities rule over her. She created him during a moment of relief and newfound freedom (during "Let It Go") and out of the cheerful memories of the time before the accident. It also represents how the isolation from Anna hurt Elsa as much as it hurt Anna. As she creates Olaf, she sings, "Can't hold it back anymore," which reveals how much she really wanted to do this with Anna whenever she was asked. The relief, happy memories, and intensity of her long-held desire are likely the reasons as to why Olaf was brought to life. In that case, Elsa's later surprise when she discovers Olaf is alive may indicate that she never even admitted to herself how just badly she wanted to rekindle her friendship with Anna. Interestingly enough, the destruction of the original Olaf marked the exact moment that Elsa and Anna's happy childhood friendship came to an end. Also, much like Anna and Elsa's friendship, the inanimate Olaf was destroyed by Elsa's power running amok due to her personal distress.
While Olaf has some of Elsa's traits in his own personality, he also symbolizes the love between Elsa and Anna. The reason for this is because when most of Anna's happy memories of playing with Elsa in their childhood were altered (those that included Elsa's magic), Olaf (as an inanimate snowman) is one thing that has always remained the same. He serves as that one special link between them, especially when they grew apart. Because he served as part of their happy childhood memories, he could very well contribute as to why Anna and Elsa still loved each other so much during the thirteen years that they were kept separated. Anna and Elsa's favorite pastime together was building snowmen, and for years during their separation, Anna knocked on Elsa's door, asking if she wanted to build a snowman like they used to do. Olaf's fascination with summer can also be interpreted as him being the link between Anna and Elsa. Since Elsa can be seen as representing cold, while Anna can be seen as representing heat, Olaf is a being of cold who desires heat, without knowing that it will harm him. Elsa and Anna both desire to be with each other, but Elsa is aware (or at least very convinced) that she will hurt Anna if that happens. So if we see Olaf as a representation of bond of love between Elsa and Anna, we can believe that his fascination with summer represents their mutual longing to be with the other again, including the potential (and severe) damage that can occur if they are together again.
With his warm, loving personality and his representation of love, Olaf is also the complete opposite of Hans and Marshmallow, Elsa's other snowman creation. Marshmallow is a big, hulking, scary snow monster without much personality development. He was created by Elsa when she wanted Anna, Kristoff, and Olaf to leave her palace and never return; therefore, he represents what her powers do when she lets her fear take over her. Olaf is the embodiment of the innocent childhood to which Elsa wishes she could return, so he is small, affectionate, and friendly. Marshmallow, on the other hand, is the embodiment of the fear and isolation in which she now finds herself, so he is big, fierce, and rough. With Hans, he can be seen as a representation of bad relationships between siblings, due to the fact that he was overshadowed by his brothers, which implies that he has strained relationships with them. He leaves Anna to die, then tries to kill Elsa, but is stopped from doing so by Anna. Anna was able to save Elsa because Olaf rescued her, which is another way of helping to support his symbolism as the bond of love between the sisters. In the end, each sister helped to save the other by the love they have for each other. So in all, there really is no way they could have done all of this without Olaf. :)
When Kristoff leads Anna to see the trolls, having referred to them as “love experts” before, Olaf says, "I like to consider myself a love expert." Surprisingly, Olaf proves himself to be one. As he was built from love and is the living embodiment of Elsa's love for Anna, he knows better than Kristoff and even Anna on what love is. Olaf teaches Anna about love, in that it is putting someone else's needs before your own. Being Elsa's creation, he would know this because Elsa did the same thing by putting Anna's needs and safety before her own when she kept her away for so long. Olaf even demonstrates his own act of true love when he stays with Anna in the library, putting her life before his, despite knowing that the fire would make him melt. (Also, in this scene, Olaf refuses to give up on Anna, much like how in the majority of the film, Anna refuses to give up on Elsa.) Even before this moment, he demonstrates love when he offers to distract Marshmallow so Anna (and Kristoff) has enough time to get away from him (Marshmallow). Then in the Valley of the Living Rock, both Anna and Olaf thought Kristoff was delusional as his "family" seemed to be just rocks to them. Olaf offered to distract him to give Anna time to run, and even showed his love for her when he said, "Because I love you, Anna, I insist you run." In the end, Olaf inspired Anna to save Elsa instead of herself, all because she loves Elsa as much as Elsa loves her. This sacrificed really benefitted because both Anna and Elsa's lives were saved. True love prevented Hans from killing Elsa, and this act of love by Anna thawed her. Olaf was even the first one to realize and say out loud that Anna performed her act of true love to thaw her frozen heart. These words, along with seeing what happened with Anna, made Elsa realize that love gave her the ability to unfreeze Arendelle.
As an additional feature of Olaf regarding how he is the link between Elsa and Anna, my friend bstormhands states that "Elsa programmed Olaf with a directive to find Anna and the magic provided him the way to do that." This makes a lot of sense to me in the scenes when he gets separated from Anna, yet he still able to find her. This includes when he first finds her in the forest (though he doesn’t know who she is just yet) and when he finds her frozen figure after he is separated from her from the snowstorm that Elsa is causing. But out of them, the best example that convinces me of Olaf being able to find Anna anytime is when he finds her dying in the library, especially because she could have been anywhere else in the entire castle and it could have taken him a long time to find her otherwise.