Nintendo in recent years has created an environment in which it can thrive. By choosing less powerful hardware and offering something unique that separates themselves from what Sony and Microsoft are doing, they are able to play to their strengths. First party titles are polished and almost always a lot of fun. They have a baked in fan base that will buy most of these AAA first party titles.
While they miss out on some of the high end multiplats, they still get a decent share of them. Between first party, some third party, indies, and retro, they have once again carved out a nice market for themselves. They are different enough that many owners of a gaming PC, PS4, or Xbox One would be happy to also have a Switch. Couple that with the diehard Nintendo fans and it a recipe for success.
"There are things which, if done by the few, we should refuse to imitate; yet when the majority have begun to do them, we follow along - just as if anything were more honourable because it is more frequent!"