The development of written scripts

What factors spurred the development of written scripts? How did the development of written scripts affect the societies that developed them?