Yes you are right, there is a luck factor for some popular apps in the AppStore, Flappy wings for example.
But luck is not the only way to win money with the AppStore.
I’m making games and music apps for the AppStore since 5 years, and from my experience, and beside luck, there is only one rule for selling app in the AppStore:
« Do a very nice app or do nothing »
Indeed, you need to be ambitious about your app so Apple feature it. If you just do an « average » app, you will not be featured, and without featuring you are lost in the AppStore 1 million apps.
Apple feature about 50 apps every thursday. If you are one of these 50 apps, you can win money, if not you will not win anything.
So you need to have a « all-in » strategy, to give all your time, energy and talents to your apps, to make a first version, to show it to your friends, to listen their criticals, to do a second version, and a third, and a fourth, until you get a real nice app.