I know many people that are paid like this, most outside of Silicon Valley even, and the common factor is that they are exceptionally skilled and proven domain experts in their field. The specific field of software is less important.
Obviously market demand does influence the salary, but there are many fields in software development where top skill will command this wage. Generally though, you have to really love what you specialize in to develop the kind of skill and expertise that will earn you this salary, it is not something you do by rote.