Carl Icahn, perhaps the greatest investor in recent years, sold off the remainder of his Netflix (NFLX -9.09%) stock earlier this week, closing the curtain on one of the most brilliant trades in recent memory.

Icahn netted over $2 billion on the trade, which he entered when the stock was at its bottom in 2012, trading at just $58, and began selling once it hit $341. To better understand why Icahn sold Netflix, it's worthwhile to look at his statements upon buying the stock.

Renowned investor Carl Icahn. Photo: Carl Icahn's Twitter page.

Timing is everything
An investor of Icahn's stature can move assets with one simple trade. Even so, Icahn's timing on Netflix was nearly perfect as he acquired 5.5 million shares -- through options and direct purchases -- in October of 2012, after the stock had plummeted on a poor earnings report.

The news of Icahn's purchase caused Netflix shares to surge 14%. They continued to move higher from there as the company built its subscriber base and demonstrated that its strategy to launch original programming and focus only on streaming was working.  

Interestingly, Icahn said at the time of the purchase that he saw "significant strategic value" for "a variety of significantly larger companies that are engaging in more direct competition with one another due to the evolution of the Internet, mobile, and traditional industry." In other words, when valued at less than $4 billion, Netflix presented an appealing target for a big tech company or even a cable provider.

That buyout never came, and at this point Netflix is probably too richly valued for a bigger company to make a pass at it. Though Icahn was wrong about Netflix being acquired (and CEO Reed Hastings refused to entertain such notions) he was right about its value.

Even during the company's troubled times, Netflix still had by far the strongest brand in streaming, a market that is fast overtaking linear TV. Netflix is now predicted to have a larger viewership than any of the big 4 broadcast networks next year. Part of the lesson for investors here is that incorrect theses can still lead to great outcomes.

Time to sell? 
One of the toughest questions for investors is knowing when to sell a stock as it's nearly impossible to deduce when one is peaking.

Netflix, of course, has been on a dramatic rise since Icahn's purchase, up more than 1000%. The company is now consistently profitable, on pace to complete its global expansion by next year, and churning out popular original programming.

Accurately valuing such a company is no easy feat. The streaming leader's profit is minimal, and its P/E is in the triple-digit range. Management has repeatedly said that earnings are being suppressed as Netflix spends to complete its international expansion. However, its domestic contribution margin is consistently improving, and the platform has proven popular internationally, as Netflix recently added its 20 millionth subscriber outside of the U.S.

The company is the clear leader in Internet TV, but developing industries change fast and Netflix is facing threats from traditional players like HBO and Showtime as well as newer services like Prime Instant Video and Hulu. 

Netflix is the top-performing stock on the S&P 500 this year as its shares have nearly doubled, but much of the stock's recent move has come from momentum, not news. That's a sign that shares could just as easily pull back in the near-term. Indeed, shares have already fallen more than 7% from their peak earlier this week, perhaps due in part to Icahn's sale.

Notably, Icahn also warned that the market in general was overheated, indicating he may be afraid of a broader pullback and prefers to put his money in more modestly valued stocks.

While Netflix could get hit with a sell-off on an earnings miss or another news item, the company is in a stronger position than it's ever been. It has over 60 million subscribers around the world, and will tap new markets like Japan, Spain, Italy, and India within the next year. Profit should continue to grow as it consolidates its global leadership and its popularity increases. Even if a sell-off occurs, long-term investors should have faith that this $40 billion company will bounce back and keep growing.