Some stock charts climb to seemingly impossible heights, at incredible speeds. Surely, the gains must be followed by a sharp drop -- right?

But that's not always the case.

The surging stocks might have risen for good reasons. An innovative business strategy earned a long-lived business advantage. The shifting sands of the consumer market presented a genuine opportunity with years of future upside. Or perhaps the doubters in a deep downturn were wrong all along, and it's just time for a formerly beaten-down stock to reflect its true long-term value.

You know how it goes.

But how do we distinguish between an overhyped bubble and a genuine rising star? What makes some stocks continue to climb despite widespread expectations of a coming correction?

I'll show you three examples of skyrocketing stocks in June that appear likely to keep climbing quite a bit higher. One or more of them could be a good fit for your portfolio, or maybe you'll find generally useful lessons about the broader market in this overview.

So let's get started with a familiar name.

Nvidia's AI advantage

Semiconductor designer Nvidia (NVDA 3.34%) is taking the stock market by storm this year. Its shares have nearly tripled year to date, soaring above the previous all-time high since the analyst-stumping earnings report on May 24.

Now, the shares aren't cheap by any reasonable measure. Nvidia's trillion-dollar stock (in terms of total market value) is changing hands at the princely valuation of 222 times trailing earnings, 57 times forward estimates, and 41 times sales. That's lofty enough to give even seasoned growth investors the hiccups.

And some of the aforementioned growth investors are cashing in their winnings nowadays. The artificial intelligence (AI) boom that lifted Nvidia to this plateau has room for plenty of competing hardware providers, and most of their stocks are much more affordable.

But nobody can hold a candle to Nvidia's first-mover advantage.

Five of the 10 world's largest and fastest supercomputers rely on Nvidia's A100 processing unit, explicitly for the purpose of AI-related computing. Advanced Micro Devices (AMD 1.31%) makes a spirited showing on that list, but has only scored two of the AI acceleration design wins among top-10 supercomputers.

Of course, one of Nvidia's early wins included OpenAI's generative pre-trained transformers (GPT), whose training processes are performed on the Selene supercomputer -- built and owned by Nvidia itself.

These important contracts give Nvidia a leg up on the next generation of AI-system number crunchers, too. It's up to AMD and other hopefuls to snatch that royal cape away from the current king of the hill. And that's easier said than done.

So yes, Nvidia's stock is expensive, but market makers drove the prices higher for all the right reasons. The company is poised to make a mint as the surging AI market evolves.

Microsoft takes a different swing at the AI market

I'm not done looking at the AI sector quite yet. Nvidia's best hardware won't make a difference without powerful software, and Microsoft (MSFT 0.73%) is putting its considerable weight into this opportunity.

I'm not saying that Windows runs the supercomputers we discussed earlier. All of the top 10 systems and most of the top 100 run some form of Linux.

But Azure, Microsoft's cloud computing platform service, is shaping up as a leader in the cloud-based AI space. Azure gives app developers easy access to a plethora of AI tools, including machine learning systems, AI-powered data analysis, ChatGPT-like AI bots, and eerily accurate speech transcription services.

Microsoft earned this catbird seat by partnering with many promising AI experts over the years. The AI boom you see today was years and years in the making, and CEO Satya Nadella has been making moves behind the scenes for a long time.

Investors caught on to Microsoft's AI leadership early in the ChatGPT-inspired boom. The stock has gained 43% year to date, making up for the growth-stock panic of 2022 and setting fresh all-time highs once again.

It's not a bargain-bin find, but value investors take Microsoft much more seriously than Nvidia at this point. The stock commands a high but not ridiculous price-to-earnings ratio of 37 and an unabashedly bullish price-to-sales ratio of 12.

Microsoft has been around the digital block for decades and is blazing an AI-powered path to long-term success as we speak. If Nvidia's soaring valuation scares you, Redmond's finest looks like a more reasonably priced way to invest in the same unstoppable AI sea change.

Roku walks a very different path

And then I'd like you to meet Roku. (ROKU 1.38%). The media-streaming technology expert took a beating in 2021 and 2022 due to an inflation-based collapse in the digital advertising sector. Video ad sales account for the majority of Roku's quarterly revenue, so it's understandable that market makers backed away for a while.

But they retreated further than necessary. Last December, the stock price fell more than 90% below the peak from the summer of 2021.

The inflation specter is moving out, Wall Street is getting comfortable with growth stocks and digital ad specialists again, and Roku is rallying. As of the Juneteenth weekend, its shares had gained 74% year to date.

That's a nice bump but far from a full recovery. And the thing is, I'm not even convinced that Roku was terribly overpriced two summers ago. We are watching a future digital media giant in its early innings. This is the one stock I keep coming back to every time I have some investable cash on hand, because I believe that its long-term growth story deserves more market respect and a higher stock price.

So Roku is the clear choice for value-minded investors, trading at the rock-bottom valuation of 3.2 times sales or 6.2 times its cash reserves. That's not just cheap in comparison to Microsoft and Nvidia, but comparable to time-honored value plays like Intel or DuPont de Nemours.

But those sleepy giants come with five-year average revenue growth measured in the single digits, nowhere near Roku's 43%. And they don't face the upcoming rebound of a temporarily repressed advertising market, which is sure to rebound with a vengeance as ad buyers come back from a few months of tight-belted marketing budgets.

Moreover, online ads should keep stealing market share from traditional ad outlets like cable TV and billboards in the long run -- ad buyers love the ability to target their marketing messages with digital pinpoint precision, after all.

Nvidia and Microsoft might be great buys right now, but I think I saved the best for last.