In many respects a side mission is the opposite of a MacGuffin (an object, idea or objective that drives the plot) because it's main purpose is to slow things down, divert or distract the PC's and lead them away from the shortest route to their objective.
There are several reasons why a side quest might be called for. As GM its a great way to plant seeds for later story development. The GM might not know this when he's writing the mini adventure but any event might be recycled later on in the story. If he does his job well the players will marvel at his forward planning and foreshadowing prowess without ever realising he's making it up on the fly.
Its also a useful way to get the PC's experienced enough to tackle the challenges they will face later in the campaign. I used this technique in my own D&D campaign because I knew what level I wanted my players to be at when they got to the climax of the story arc and needed to give them a chance to earn vital experience points and acquire magical items.
A side adventure may also be the result of the GM's idea box overflowing. Maybe he's had a good idea for an encounter but can't see how to insert it into the campaign. The solution is to create a little detour that sets up the encounter without disrupting the internal logic of the main story arc.
Sometimes however a side adventure is just there to throw a spanner in the works and upset the status-quo. If that is the GM's reasoning then players should beware, because all the rules can be broken. This is the GM at his most dangerous and reckless. This is when PC's fall , never to rise again (except with the help of a resurrection spell and an associated side quest to acquire it!). This sort of side quest should come with a health warning.
So tonight our PC's embark upon a seemingly random mission to clear an area of undead infestation. The official reward for this act of bravery is the opening of the route ahead which will enable us to complete our main quest to recover the Crown of Nobility. In reality the rewards may be more complex and subtle than that and the dangers infinitely more deadly than any of us can appreciate.