A post with 100 upvotes gets a gold badge, and that's more likely to happen with a detailed / explanatory answer that has future value instead of just solving a one-off problem for one asker.
Most of the incentive for writing good explanatory answers is from the satisfaction of doing it right, and writing the kind of answer you'd like to find if you were searching for something. But badges are one way that the gamification system does incentivize posting fewer good/long answers, rather than many short low-effort answers.
Also the occasional bounty; I've had bounties awarded by askers who really appreciated my detailed explanation of something, even on a question that didn't get much attention.
Getting a gold badge for a great answer is pretty much a lottery, though. In some tags (like [x86]
[assembly]
/ performance-optimization where I hang out), it's very rare that a question gets enough traffic to get that many upvotes. But it's happened a couple times that a good question came along that I was able to write a very detailed answer for, and which caught the attention of the masses.
I have some other canonical answers that are gradually creeping up in rep, and many of them have passed similar short answers with less explanation on similar questions. So a well-explained answer will keep getting you votes in the long-term, more than you'd get with a mostly-code answer.
Definitely the main motivation for me is that SO is a good place to go into massive detail about something specific. Leaving the info here in answer to a specific question means that people will be more likely to find it in the future than if I wrote blog posts. (And besides, then I'd need to think of blog-post topics myself instead of waiting for people to ask interesting questions.)
I got my rep the hard way, by tilting at windmills. :P
Recently I've been spending time going back and cleaning up and improving some of my detailed answers, since some of them were written as I was figuring things out. Also, new CPUs have some differences, so some of my asm optimization answers can use an update. It's not a lot of fun, but I was burned out on looking at new questions (since by now many of them are the same beginner questions I've seen multiple times before).
I definitely have a hard time keeping my answers from getting unreadably long, though. Saying a lot with few words is hard, though.
I would have written a shorter letter, but I did not have the time.
-- Blaise Pascal
Hitting the 30k char limit has forced me to spend time trimming out less-important stuff, or conveying the same info with more brevity.