Not luck: pay attention to what the community needs, and be in a position to execute when you spot it.
On the contrary I think quite a lot of luck is usually behind the second part of that.