Investing is a long-term endeavor. The best time to buy a stock, assuming you're able and willing to hold that stock for years, is often when pessimism is running high. Turnarounds take time to play out, but they can pay off handsomely for investors with the patience to see things through.

Two stocks that look down and out right now but that have the potential to reward buy-and-hold investors are retailer Target (TGT 1.99%) and chip giant Intel (INTC 2.43%).

Target

The pandemic's height was a period of rapid growth for retailer Target. The company, armed with a cadre of convenient same-day services including curbside pickup and delivery, was a magnet for consumers' dollars. Comparable sales soared 19.3% in 2020 and 12.7% in 2021 -- incredible numbers for a big-box retailer.

The hangover from this growth began in 2022 and is now continuing into 2023. Comparable sales rose by just 2.2% last year, partly due to issues with excess inventory, and partly due to weakening consumer demand for a variety of categories. Challenges with demand plagued the first quarter of 2023 for Target, with comparable sales rising by just 0.7%.

Target's pandemic-era profitability is also a thing of the past, with operating margin coming in at just 5.2% in Q1. That compares with an operating margin that topped 9% at times during 2020 and 2021.

While the next few years will likely be challenging for Target, particularly if the U.S. enters a recession, the retailer has laid a solid foundation for long-term growth. Target's same-day services are still growing at a healthy clip, a testament to how much people value convenience. Overall digital comparable sales were down in Q1, but same-day services grew by a mid-single-digit percentage, and curbside pickup grew by a high single-digit percentage.

Once Target emerges from this malaise, growth won't be as impressive as it was during the pandemic's height, and margins likely won't be as high. But Target's stock price now reflects this reality. The company expects to produce earnings per share between $7.75 and $8.75 this year, putting the price-to-earnings ratio just under 16 at the midpoint of that range. That looks like a reasonable price to pay.

Target stock may not end up being a winner this year, but a different story will likely play out over the long run. If you stick Target stock in your portfolio and hold on until 2030, odds are you'll like the result.

Intel

Semiconductor giant Intel is in the painful part of a multi-year comeback. After losing its manufacturing edge to foundry TSMC, and thus losing its advantage over rival Advanced Micro Devices, Intel is doing two things to right the ship. First, the company is rolling out new manufacturing nodes at an incredible pace. The plan is for five new nodes in a four-year span, ending with its sub-2nm Intel 18A process in late 2024. So far, that plan is on track.

Second, Intel is building out its own foundry business. The heavy investments in manufacturing only make sense if Intel can leverage them to generate additional revenue by manufacturing chips for others. The foundry business is not a meaningful source of revenue right now, but the company has plenty of potential customers in the pipeline that could become foundry customers once Intel's advanced nodes roll out next year.

Intel has already clawed its way back in the PC central processing unit (CPU) market, largely besting AMD with its latest Raptor Lake chips. AMD still has a significant advantage in the server CPU market thanks in part to chronic delays on Intel's part, but that story could change over the next couple of years as Intel launches new products. If Intel can regain a manufacturing edge over TSMC, which makes AMD's chips, that will translate into an edge in the server CPU business as well.

Intel's turnaround likely won't come into full view until 2025, and it will take time beyond that for the foundry business to ramp up. But the second half of the decade should look a lot better for Intel than the past couple of years have looked.

Investors shouldn't wait until then to buy the stock, though. Shares of Intel are down nearly 60% from their all-time high, and pessimism is still elevated. The time to buy the stock is now, before the turnaround really starts to gain traction.