Trying to pick a stock based on who you think will win the upcoming presidential election can be difficult. 

To help investors find technology stocks that could thrive over the next presidential term, we asked a few Motley Fool contributors for stocks to buy ahead of the election. They came back with Fastly (NYSE:FSLY), Twilio (NYSE:TWLO), and Shopify (NYSE:SHOP). Here's why.

A stack of money sitting on top of an American flag.

Image source: Getty Images.

Fastly: Buy this stock fast

Danny Vena (Fastly): It's been a rollercoaster ride for Fastly investors in 2020. The content delivery network (CDN) and edge computing specialist had been on a mind-boggling run, gaining 540% through early October -- then the bottom dropped out. The company released preliminary third-quarter results on Oct. 14, giving investors pause. In the two weeks since that announcement, Fastly stock has lost nearly 48%.

You might think the news was simply awful, given the cratering stock price, but that simply wasn't the case. I would argue that while extenuating circumstances have taken Fastly out behind the woodshed, investors with a long-term outlook should view this as a buying opportunity. Here's why.

In conjunction with its acquisition of cybersecurity provider Signal Sciences, Fastly gave a sneak peek at its results, saying that its revenue would be about 5% lower than it first estimated, in a range of $70 million to $71 million, down from its initial guidance of $73.5 million to $75.5 million. 

Management gave investors a couple of reasons for the revised outlook. Usage by its largest customer -- which has previously been revealed as TikTok parent ByteDance -- was lower than expected, due to the "uncertain geopolitical environment." But it turned out TikTok wasn't the only culprit, as "a few customers had lower usage" than management estimated late in the quarter.

Since Fastly's revenue is based on usage, it's hard to fault management for its inability to peg exactly how much its various customers would use its services, so I'm willing to give the company a pass on that. I think it's the TikTok factor that's the biggest issue for investors, since the platform was responsible for 12% of Fastly's revenue in the most recent quarter.

The Trump administration has been dogging the heels of the viral video platform, citing national security concerns and a risk to user data. President Donald Trump has worked to ban the app, but a federal judge granted TikTok a temporary injunction back in September, effectively staying the ban. At the same time, Oracle and Walmart have entered into a deal to buy TikTok's U.S. operations and Trump has given his tentative blessing to the deal. 

The former issue is still working its way through the courts, but with the U.S. election next week, I would say the time to buy Fastly is now. The court seemed reticent to allow the ban, so if the injunction is upheld, Fastly could soar. Additionally, if there's a change in administration, the point could be moot, the result of different priorities, again benefiting Fastly.

I'm not just giving empty advice, either: I added to my Fastly position just last week.

Expanding on an already massive opportunity 

Brian Withers (Twilio): Twilio was founded to make software-driven communications easier. It has a set of easy-to-embed communication-based application programming interfaces (APIs) and makes money on each communication message that's created as software developers use the APIs to enable a company's applications to initiate calls, texts, emails, and even video chats. This might be an automated call to remind you of an upcoming appointment, a text message letting you know that your package was delivered, or an email that your prescription is ready for pickup. This robust communication platform has turned into an impressive business. 

Twilio just announced solid results from its third quarter ended Sept. 30. The top line grew 52% year-over-year to reach $448 million for the quarter, beating analysts consensus of $407 million. Its dollar-based net expansion rate was 137%, up from 132% for the same quarter a year ago, and its adjusted net income per share beat analysts' expectations to come in at a positive $0.04. The company is still losing money under generally accepted accounting principles (GAAP) as it focused on growth rather than profits. But investors shouldn't worry too much about the $112 million GAAP loss from operations for the quarter, as its $3.3 billion in cash and marketable securities on its balance sheet will keep the company afloat for years.

The company's addressable market for digital communications is an impressive $62 billion for 2020, growing to $87 billion by 2023. With $1.5 billion in trailing-12-month revenue, it has less than a 3% share of the market. But its market is set to get even bigger. In mid-October, Twilio announced an all-stock $3.2 billion acquisition of Segment, a customer data platform company. This platform collects data from disparate data sources across the enterprise, such as a consumer's browsing history on the company website, the text from a customer service chat, or a post made on the company's social media page. Once this data is consolidated, it can provide a 360-degree view of the customer, allowing the business teams inside the enterprise to get to know their customers better. This adds an estimated $17 billion in market opportunity for Twilio.

After the acquisition closes sometime in the fourth quarter, investors will get a better idea of Segment's revenue, and the opportunities to cross-sell and integrate the products. But on the surface, this acquisition looks like a great fit. The customer data platform allows Twilio's APIs to plug into a rich data source on a company's customers to enable messaging to be more personalized, smarter, and targeted to better engage customers, which is something that Twilio's customers have been asking for.

Twilio's stock has pulled back from its recent 52-week high, and investors could scoop up an incredible growth story at this discounted price before the election. As the market comes to realize the massive opportunity still ahead for this proven operator, investors may not be able to get the stock at this price in the future.

This company will win big no matter who's president 

Chris Neiger (Shopify): Shopify, an e-commerce platform company, has experienced explosive growth this year as many companies were forced to shift from their physical shops to online ones. Shopify's platform has allowed these businesses to adapt to the pandemic, and no matter who wins the election on Nov. 3, this company is poised for more growth. 

In Shopify's third quarter (reported Oct. 28), the company's revenue skyrocketed 96% and its gross merchandise volume, the amount spent on Shopify's platform, jumped 109%. Additionally, the company's subscription revenue increased 48% from the year-ago quarter thanks to more merchants joining Shopify's platform.  

As impressive as those figures are, Shopify is poised to continue growing for years to come. There's no end in sight to the pandemic right now, and even after it's long gone, many businesses have learned that they need to have a strong online presence to continue reaching customers who prefer online shopping

E-commerce sales account for just 16% of all U.S. retail sales right now and as more businesses set up online shops many of them will use Shopify to get them up and running.

Shopify's stock is down 7% over the past three months (though its share price is up 146% year to date) which means that right now might be a good time to snatch up some shares before the stock begins climbing again.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.