the Wii was big, like really big, so big that Nintendo had to ask themselves how they could make something that big again. but what?
they needed a big demographic, aka the same casuals who bought the Wii, but they needed to know what the casuals liked, and the casuals liked tablets.
the solution - make a console and a tablet have a baby. it would have all the best pars of a console and a tablet. but instead it had all the worst parts of a tablet and a console.
the gamepad was expensive, so they had to make cuts. the hardware was now very underpowered in order to keep it affordable. what they were left with was an underpowered console that nobody knew how to make games for because it had a tablet controller.
the PS4 and Xbox One then came to market, with better hardware, and no tablet controller making it easier to make games for. so the devs abandoned the Wii U.
but what about that sweet sweet casual market Nintendo had going for it? it turns out they stopped existing, which really hit them hard because Nintendo was banking on casuals so hard that they forgot to advertise the Wii U so nobody knew what it was. also people loved the PS4 and Xbox One so much that they advertised themselves on top of actual advertising.
so the Wii U failed due to bad marketing, a small games library, tough competition, and bad hardware.