People buy stuff they don't need all the time. Games and other entertainment are the very definition of "nice to have", and they're vast markets. Even business tools are usually not "needs" if all they do is improve an existing product.
It's incredibly hard to know what will attract people. Even if you know categorically that a thing will make their lives better, people often won't get it, and instead spend their money on something objectively useless.
It seems to be luck as much as anything else, being in the right place at the right time. It catches a "buzz" for whatever reason and becomes popular, or fails to and doesn't. Knowing it beforehand would be great, but nobody ever does.