Taking off from a discussion about writing that was started recently by Philip Roth, Avi Steinberg chips in with the view that writers are unhappy people. It's hard to assess his view, because it's not clear what proportion of writers he means it to apply to. But anyway, this is his emphasis:
I know plenty of writers for whom living in their own mind is a far from pleasant experience. Writers are very often miserable people: some thrive on unhappiness, others don't. But few are immune from feelings of deep and avid dissatisfaction. We write because we are constantly discontented with almost everything, and need to use words to rearrange it, all of it, and set the record straight.
I'd say that that view is way too narrow. Primo Levi wrote an essay (which can be found in Other People's Trades) trying to answer the question 'Why Does One Write?' These were his answers: because one feels the drive and the need to do so; to entertain others and oneself; to teach something to someone; to improve the world; to make one's ideas known; to free oneself from anguish; to become famous; to become rich; out of habit. That's quite a variety of reasons, and Levi allowed that one could come up with others.
Given both the number and the variety of reasons for writing, my hypothesis would be that there is every which kind of writer, ranging from unhappy to reasonably contented, and I'd be sceptical about the unhappy kind massively predominating.