Concerns about higher inflation and a weakening economy pushed indexes into a bear market back in 2022, but last year, things began to look brighter. Many companies made efforts to cut costs and focus on their most profitable businesses, spurring a rebound in earnings. E-commerce and cloud computing giant Amazon is a perfect example of that, and the stock has climbed nearly 70% over the past year.

And investors became more optimistic about the environment in general amid signs that interest rates could come down this year -- in a recent Reuters poll of 100 economists, half expect two rate cuts in 2024. Though rate cuts may come later than expected and may be fewer in number than economists originally predicted, a stabilization of rates or any reduction is a sign the economy is moving in the right direction. And that's positive news for companies and investors.

As a result of all of this, indexes climbed last year and extended gains this year, with the technology heavy Nasdaq recently soaring to a record and confirming the presence of a bull market. These are exciting times, but with many technology stocks racing higher, you may be wondering if it's still a good idea to invest -- or if it's better to wait for these movers and shakers to get cheaper. Let's talk about the best investing move you can make right now.

A gold-colored bull is shown in front of candlestick market patterns.

Image source: Getty Images.

Investing in AI

First, a quick note about the element -- beyond economic factors -- that's been driving the momentum, and that's artificial intelligence (AI). Technology companies have been investing heavily in this innovative area that promises to transform many industries and our daily lives. Some companies, like Nvidia and Intel, design chips to power something critical to the functioning of AI -- the training of AI models so that they then can answer complex problems.

Other companies, like Amazon, through its Amazon Web Services (AWS) business, sell AI platforms to customers. And still others, such as biotech Moderna, are using the technology to streamline their own operations and help them more quickly produce better products.

The AI market is expected to reach more than $1 trillion by 2030, so it's logical that so many companies are doing what they can to eventually benefit. And it's also no surprise that investors, too, are hoping to benefit by piling into shares of eventual winners.

So right now, it's clear that technology shares, and particularly those involved in AI, are leading the Nasdaq and the general market higher.

Now here's the best thing you can do: Keep investing, and invest for the long term. Don't get distracted by stocks that could pop on short-term news but don't have a compelling long-term story. Instead, focus on the strongest players -- within the AI field and beyond, as it's always a good idea to diversify -- and favor them.

Alphabet's first dividend

For example, Alphabet (GOOG 0.52%) (GOOGL 0.55%) is making AI a priority, recently releasing its most powerful model ever -- Gemini -- that it's rolling out across its products and services to make them better than ever. At the same time, the tech giant this week wowed investors by announcing its first ever dividend and a massive stock buyback plan. At 23 times forward earnings estimates, the stock price is reasonable even after recent gains -- especially in the context of holding on for the long term.

To diversify beyond technology and AI, pharma giant Eli Lilly (LLY 2.18%) makes a top buy thanks to its broad portfolio of blockbuster drugs, including two prescribed for weight loss that could significantly increase revenue in the coming years. Lilly has climbed 88% over the past year, but thanks to its strong earnings growth track record and potential ahead, the stock still makes a great long-term buy.

Those are just a couple of examples of rising stocks that still have room to run, but many others exist. And even in this bull market, you still will find quality stocks that haven't benefited, offering you the opportunity to pick them up at dirt cheap valuations.

Time is on your side

It's also important to keep in mind that time is on your side as an investor. If we look at the Nasdaq over time, as seen in the chart below, it has eventually declined after periods of gains -- but it's later gone on to win again.

^IXIC Chart

^IXIC data by YCharts

So even if the market dips or falls at a certain point, it's likely to follow historical patterns and return to a bull phase. And this means that if you remain invested over time in quality companies or even in an index tracker, you're likely to score a win.

Today, momentum is strong, and the feeling in the market is positive, but that doesn't necessarily mean that every stock is too expensive and that you should hold off on buying. Instead, continue investing according to your investment style -- cautious or aggressive.

And, most importantly, choose companies you want to hold onto for a number of years. This way, you may benefit now during the bull market and over the long haul.