How is a paper with multiple authors usually written? I am attending graduate school this fall and one thing that I still could not wrap around my head is that some of the papers are written by seemingly a group of authors (5 people or more). I am curious how this is usually done.

Are each person assigned a small chunk of work and the paper is put together when everyone is done? This raises so many questions such as what if a person doesn't finish his or her part? How do you piece together the paper so that it is coherent throughout (since people may have different perspectives or understanding).

And is there important differences between a paper written by two person and those written by five or more?
I think that this article from the Research Whisperer covers aspects of how multiple authors can collaborate to get a paper done. It is an interesting and quite brief read that I would recommend. 

TL;DR version: 


One leads the project and the initial drafting with others
contributing to an almost complete draft. 
The team splits the work into broad sections for each collaborator, which then draft, combine and revise.
Decide on all the details and each writes its own section with minor final corrections. 


From my experience, the first one would be the most common with an almost final version making it to the very senior people in the article.