When you buy a share of stock you become part owner of a business. Before doing that you need to assess its fundamentals such as what the company sells as well as its revenue, profitability, and cash flow growth rates. It's also important to assess how much of that revenue the company keeps (margins). Moreover, you should also determine whether the company retains some of that cash for reinvestment in the business. Growth in revenue and cash flow generating capability while utilizing as little external capital as possible is what determines superior long-term gains versus the overall market.
It also pays an investor if that company sits behind a huge barrier to entry against competitors. Competitors dilute the profitability of your company while lowering the potential for superior long-term gains.