The stock market is actually a secondary market. The entrepreneur who needs capital can get it through private investment or through an IPO. The stock market provides liquidity to those who already own (either initial founders or later investors) shares in the company; by liquidity I mean it allows those shareholders to turn the wealth represented by ownership in a company into cash by selling shares. On the other side buyers in the stock market hope that the wealth represented by owning shares in a company will go up as the company grows, or hope that the company will make profit and pay some of that back in the form of dividends to all part owners.
So if we can agree that there's a societal need for entrepreneurs to raise capital through giving up equity, we can agree that there's a societal need for the stock market to contribute to liquidity of such equity. And if we can agree to that, we might agree that any way inefficiencies can be weeded out of such a market is a boon to society. That last sentence is fundamentally the question that people are trying to investigate: is HFT contributing more to the stability of the stock market than the value it extracts? A free markets proponent might say that if they're still in business, that must be the case, but a counter point would be that the market is not constructed (regulated) in such a way that allows the true worth of an action to shine through. I think that's a question everyone's been trying to answer.
Why do you want to do this? Are you just curious or trying to get something on your resume? This is an important question because a diversity of advice can be given without knowing the answer to this.
I'm not an expert and probably not qualified enough to answer this question, but in my experience, you can't just start looking at a large project on your own and expect to get anywhere. As an example, any undergrad level OS course will only dig you skin-deep into the Linux kernel. The way I imagine things to work is, someone with more experience in the project you want to work on will help you get started contributing and learning the code base. Alternatively if you use a product extensively and know exactly what you want to contribute and why, you go in with surgical precision and try not to screw it up.
Ok, in any standard supply-demand analysis, you will find that if a company is attaining non-zero profits, in a competitive environment, another company WILL sprout up out of nowhere to snatch a percentage of that, possibly by selling the same products at a lower cost. This reduces the sum total profits attainable by both companies. The reduced value goes into the pool of money that customers get to KEEP.
However! There is a catch to that. It's called barriers to entry. Examples include: patents that the first company holds that are required to produce the product, infrastructure required to deliver the product (think ISPs' fiber, cell towers), and marketability (if you wanted to sell an OS in the mid 1990s, your company name better be Microsoft). There is a huge (debatable in terms of fairness) advantage the market gives to the FIRST guy to succeed in a certain line of business.
So in your examples, it's not in 100% of the cases in small businesses, they give up profit out of a sense of misplaced altruism. It's simply that they don't have anything that can command a higher profit. For companies that rise up again and again in the news (Microsoft, Apple, AT&T, Verizon, the list goes on), they DO have the chips to play. They understand that barriers to entry prevent Joe Shmoe from writing his own OS or making his own smart phone or building his own cell network and compete successfully with them. They understand they are not in a perfectly competitive environment and can thus act monopolistically or oligopolistically.
This is all not to say that analysis involving assumptions of a competitive environment is purely academic and impractical. In this case, the best action for any governing body to do is to try to increase the competitive potential of the market. This is why they allow certain mergers. The standard case is when two small companies merge to better compete against a bigger one (see Thompson-Reuter vis-a-vis Bloomberg). They will/should never allow a merger that is purely or mostly for eliminating competition (which is the case that was leaked here).
Beware of the Turing Tar-pit in which everything is possible but nothing of interest is easy.