According to Guns, Germs, and Steel, why did writing arise and spread to some societies, but not to others?
The answer to this question can be found in Chapter 13 of Guns, Germs, and Steel. There, Diamond discusses various aspects of the way in which writing develops and diffuses. The discussion of your question begins on p. 233, though the actual answer does not appear until pp. 236 and 237.
The first part of your question asks why writing arose in some societies and not in others. First, it was very unlikely that writing would arise independently in many different societies. This is because it is so hard to come up with the idea of writing and to develop a writing system on your own. Diamond says that the vast majority of societies borrowed writing from the few places that invented it independently. The few inventors of writing, Diamond says, were those who started farming first. Writing is of very little use to hunter-gatherers and no such society ever invented writing. It is useful to farming societies once they reach a certain size and level of sophistication. Therefore, the societies who started farming first were the ones who actually developed writing. As Diamond says on p. 236
Writing arose independently only in the Fertile Crescent, Mexico, and probably China precisely because those were the first areas where food production emerged in their respective hemispheres.
The second part of your question asks why some societies borrowed writing and others remained illiterate. Diamond attributes this to the remoteness of some societies. He says that the societies that did not borrow writing were those that were too far away from societies that had writing. Some of these societies, like that of Hawaii, were a long way from the nearest literate societies. Others, like that of the Incas, were not really that far from a literate society in miles, but were separated from them by terrain that was very hard to cross. Thus, some societies did not borrow writing because writing could not reach them.
Writing, then, only arose independently in places that got agriculture first. It diffused to almost all societies, but it failed to reach some societies because they were too isolated.