The Wii had a lot of third party games, but too many were shovelware. You can really contrast this to Sony, who also has a heavy focus on first party titles but robust third party support.
Nintendo's failings were technological. I've heard plenty of rumours that the N64 was more powerful than the Playstation's. Which could have given them a major advantage, had they used CDs instead of cartridges. Yes, CDs had horrendous load times, but they could hold 10x the data. Which means larger textures, bigger game worlds, FMV cutscenes, and better music. Cartridges also cost more to mass produce, thus N64 games were more expensive.
I think Gamecube just got steamrolled by the PS2. A lot of people think it was a failure but it was only 3 million units behind the Xbox. By the end of the sixth generation in 2005, the PS2 had sold double what the Xbox and Gamecube had, combined. Really tough to beat that.
The Wii had a lot of initial success but failed to attract strong third party support. It did have strong numbers to support it. However, I think third parties saw it as a system to make a quick buck on. Developers wanted to put their energies into the more powerful HD systems. The Wii won the console wars on units sold, but it was a pyrric victory. Casual gamers don't spend a lot on more expensive titles. Out of the Wii's top 15 best sellers, only one was a third party title. Third party games sell better on Sony and Microsoft platforms.
The Wii U's problem brings us back to hardware once again. It's a generation behind its contemporaries, the Xbone and PS4. Devs want to work with the newer hardware. It's also too similar to current generation systems that many gamers already have, while at the same time being more expensive. It's gimmick also isn't as strong as the Wii's IMO. On the software side, Nintendo hasn't really mastered the art of digital sales yet. It's still too early to say the Wii U is toast, but it definitely won't be the runaway success the Wii was. Nintendo needs to work on wooing third parties to make quality titles for their platforms if they want to stay in the hardware game.