Neither devices, nor OS failed as such.
They have been terminated from development and then from support by Microsoft.
This is a big difference.
Go hereand observe for yourself. There is quite a considerable 'bump' around 2014 and the only reason it did not lift off is the utter uncertainty that Microsoft created around the future of the platform. These worries turned real.
Look at the Android early years. It also had low market share initially, but the licensing model, advertisement and help in writing apps/SDKs won. To remind you how terrible Android and its devices were otherwise initially? Compared to just any version of
metro-styled mobile Windows.
So once again, it did not fail. It was failed, quite intentionally.