Ideally you would want to be in a niche that will directly influence revenue, makes it easier to sell your service for a high price.
patio11's post in this thread is a good example (https://news.ycombinator.com/item?id=5769870), increasing conversion rates for X will directly effect the bottom line by Y. As long as the price you charge is lower than Y, you should be able to sell it.
Other than that, specialized knowledge is always handy of course. I know of consultants doing compliance/IT systems for banks, highly profitable since the banks only change IT systems every 10 years or so and therefore it makes no sense to keep the cutting edge expertise in house but there are enough banks so they always have work.
It does vary depending on where you live though, I don't know of many charging $400/hr (or equivalent) in Sweden. Same rings true for the limited experience I have in The Netherlands.
Edit: Edited for clarity.
Edit2: Looking at your HN profile: why not consulting in Big data or such? Big data is all the rage at the moment and it is a new niche that everyone wants in on.