Since stocks began trading on the Nasdaq, the index has produced negative annual returns only 14 times. What's more, the index has dropped by at least 30% on just three occasions over the last two decades.

What investors might not realize is that following these steep drops in 2002 and 2008, the Nasdaq went on a rally for consecutive years thereafter.

Similarly, following a harsh 2022, the Nasdaq rebounded sharply last year -- returning 43%. This was largely driven by euphoria surrounding artificial intelligence (AI) in the tech industry. With 2024 getting off to a red-hot start, further gains could be in store for investors.

While each of the stocks below enjoyed AI-driven momentum in 2023, I think all of them look appealing given the long-term secular growth prospects in artificial intelligence for software developers.

1. Palantir Technologies

The first company on my list is a staple among Cathie Wood's exchange-traded funds (ETFs). Palantir Technologies (PLTR 3.73%) develops a host of data analytics software tools that it sells to the U.S. government and its Western allies, as well as to the private sector.

2023 was a transformational year for Palantir as the company released its fourth flagship product: the Palantir Artificial Intelligence Platform (AIP). Management developed a creative lead generation strategy to get the word out about AIP, as the market had become flooded with competing products. Palantir began hosting immersive seminars called boot camps during which prospective customers can demo its software and identify a use case for AI.

Since AIP's launch last April, Palantir has hosted more than 500 boot camps. To put this into perspective, the company had 92 demo pilots in all of 2022. While the demand to attend boot camps is impressive, the conversion to actual paying customers is even more encouraging.

Palantir grew its customer count by 35% year over year in 2023. The rapid adoption of customer acquisition has fueled meaningful margin expansion and free-cash-flow generation for Palantir. The company is consistently profitable on a generally accepted accounting principles (GAAP) basis, and ended 2023 with $3.7 billion in cash and no debt on its balance sheet.

Indeed, at a price-to-sales (P/S) ratio of 25.5, Palantir stock isn't exactly cheap. However, investors should realize that over the last few weeks the stock has experienced some momentum given the company's blowout fourth-quarter report. Nevertheless, Dan Ives of Wedbush Securities still sees substantial upside in Palantir stock given the company's initial success with AI.

So even though Palantir stock is trading at a premium, I think it's warranted. Long-term investors may want to scoop up some shares in Palantir as the company quietly emerges as a winner in the AI landscape.

2. ServiceNow

Next up on the list is IT data management company ServiceNow (NOW 1.02%). One of the core pillars for corporate executives is having the ability to make data-driven decisions efficiently.

The challenge facing large enterprises is that they typically rely on several different platforms to store data. Unfortunately, these systems rarely communicate with one another easily -- putting decision-makers in a difficult position. ServiceNow helps businesses transform their operations by seamlessly connecting their data across digital platforms.

According to IT research firm Gartner, $6.5 trillion will be spent on technology services by 2027. Even better? IT services and software are expected to account for the majority of this spend. That is a really good sign for ServiceNow. Considering the company is already doing a stellar job acquiring new customers and expanding its existing base, things could just be getting started as AI plays a major role in enterprise digital transformation.

At a recent P/S ratio of 17.7, ServiceNow is trading relatively in line with its long-term average. I see the stock as undervalued, and think ServiceNow is overlooked among leading software-as-a-service (SaaS) investment opportunities.

People working in an office looking at data queries on their computers.

Image source: Getty Images.

3. Salesforce

Salesforce (CRM 0.42%) was the top performing stock in the Dow Jones last year. What makes Salesforce unique is its portfolio of different businesses that it has acquired.

While these deals were initially cheered, ongoing integration efforts and stalled monetization eventually took a toll on investor enthusiasm. However, as IT budgets are increasingly allocating more capital toward artificial intelligence, Salesforce may have just unlocked its newest opportunity.

The company is marketing itself as an end-to-end AI-powered ecosystem for workplace productivity, stitched together through its platforms MuleSoft, Tableau, and Slack. While it's still early innings, Salesforce is already showing some accelerated growth due to the influence AI is having on enterprise tech stacks.

I think Salesforce is going through a bit of a renaissance, and the company looks well positioned to continue growing in the long run as it offers a much more sophisticated, full-spectrum platform for workplace automation tools compared to its peers.

4. Datadog

Datadog (DDOG 4.95%) is an emerging player in the cloud computing industry. The company offers a cloud monitoring platform to help keep data safe and secure.

DDOG Revenue (Annual) Chart

DDOG Revenue (Annual) data by YCharts

In 2023, Datadog grew its top line 27% year over year to $2.1 billion. While revenue growth is forecast to slow over the next couple of years, the trade-off is that management is calling for expanding operating profits.

I'll take modestly slowing revenue in exchange for long-term sustained profitability. At a recent P/S of just 21.8, Datadog stock is trading at a steep discount compared to its 10-year average of 31. Now could be a terrific opportunity buy shares in Datadog stock as the company moves toward becoming a more mature, profitable business.

5. MongoDB

The last company on my list is NoSQL database management platform MongoDB (MDB 4.83%). As of the end of the company's fiscal third quarter of 2024, ended Oct. 31, 2023, MongoDB had approximately 46,400 customers -- an increase of 19% year over year.

The acceleration of customer acquisition and top-line growth of 30% has helped MongoDB erase its losses. For the nine months ended Oct. 31, 2023, MongoDB generated $59.4 million in free cash flow. By comparison, the company's free cash flow was negative $48.6 million through the first nine months of 2022.

At a P/S of 19.4, MongoDB is trading slightly below its 10-year average. Furthermore, given the addressable market for database software is expected to reach $189 billion by 2030, MongoDB's growth prospects look robust. Now could be an interesting time to begin building a position in MongoDB stock and preparing to hold for the long run.