A combination of factors.
The poor marketing was I think the biggest factor. Commercials for the system and its games were uncommon leading up to launch and almost nonexistent for months afterward. The commercials it did have focused heavily on the touchscreen controller and not enough on the games or even the fact that it was a new system. There wasnt any heavy ad presence until the holiday season of 2013, and even then they only tried to target kids and families, not once attempting to go after core gamers. After the 2013 holidays, Wii U commercials essentially evaporated once again. However, starting with Smash Bros. 4, Nintendo began to more actively promote their major Wii U games, though by that point it was too late to do anything to help hardware sales. Add on to this a name that was confusing.
Considering the brilliant and omnipresent marketing for the Wii, Nintendos failure to properly market the Wii U came as a surprise and likely worked against the system. For example, it is frequently claimed that many low-information consumers were unaware that the Wii U is a new-generation system, but rather thought it was a tablet peripheral for the Wii. Given the 2012 ad campaign, its easy to see how one could come to this conclusion. Nintendo themselves effectively admitted this in the aforementioned Holiday 2013 commercials for the Wii U, which made a point in stating plainly that, yes, the Wii U was an entirely new system.
Now, one could make the case that the tablet controller was the source of most of these problems. It was integral to the system, but it was also a much harder sell than the simpler, more intuitive motion controls that were the Wii's primary selling point. And the gamepad wasn't cheap, either. While the Wii U wasn't much more expensive than the Wii when you account for inflation, if Nintendo hadn't made the tablet controller so central to the system they could have released an even cheaper SKU. And there was no way to buy the gamepad separately, at least not until 2015, and even then only in Japan (and it cost nearly 14,000 yen, and it was region-locked).
Of course, that wasn't the only problem. There was a serious software drought early in the system's life. It had a relatively underwhelming launch library to start with, with the biggest title by far being New Super Mario Bros. U (which I personally think was the best of the NSMB series). But after launch there was hardly anything of note for months after launch. In fact, it would not have a major first-party exclusive again until Pikmin 3 was released in the summer of 2013, some eight months after the system was released. The Wii U spent its first year severely lacking any must-have exclusive content. By time the Wii U had amassed a solid library of exclusives, it was too little, too late.