The same way you're supposed to know if a bike is stolen. If the given market is grey/shady and the price is excessively low, and you really want to know, you ask (for starters).
If everyone got a "free" bike when you bought a computer then the people who didn't want to use their's and so bothered to sell it would probably sell it for $10 or so?
You can get £20 books for 50p, because either the person has finished using the book, and there are lots of books; or because the person got the book free (as a gift generally) and didn't really want it; or because they bought a copy and got a second copy gifted, etc.
Software isn’t a bike. It might be a special deal Microsoft has with those vendors. Bikes have an intrinsic minimal cost, like materials and shipping, software keys don’t. The average consumer would probably regard windows as something that is free to begin with so seeing it for sale for $10 probably won’t strike them as strange, you get it “free” with your computer after all.
Furthermore, this is not one vendor selling one ‘stolen’ item, it is many, selling many keys. This makes it seems like a legitimate channel for keys to the average consumer. It also makes eBay more responsible if you ask me. It seems to me as if they are making a profit from those sales. If they truly are illegal keys then they should probably do something about it.