Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I ask when I'm curious. Sometimes, it's a real problem.
I answer as a hobby, to relax. Sometimes, it helps someone.
The other reasons are vanity ;)