And a Microsoft chat bot, intended to learn “conversational understanding” by mining online text, was quickly retired this year after its machine-learning algorithm began generating racist comments.

Even well-meaning attempts to harness data analysis for the greater good can backfire. Two years ago, the Samaritans, a suicide-prevention group in Britain, developed a free app to notify people whenever someone they followed on Twitter posted potentially suicidal phrases like “hate myself” or “tired of being alone.” The group quickly removed the app after complaints from people who warned that it could be misused to harass users at their most vulnerable moments.

This week’s failed election predictions suggest that the rush to exploit data may have outstripped the ability to recognize its limits.

“State polls were off in a way that has not been seen in previous presidential election years,” said Sam Wang, a neuroscience professor at Princeton University who is a co-founder of the Princeton Election Consortium. He speculated that polls may have failed to capture Republican loyalists who initially vowed not to vote for Mr. Trump, but changed their minds in the voting booth.

Beyond election night, there are broader lessons that raise questions about the rush to embrace data-driven decision-making across the economy and society.

The enthusiasm for big data has been fueled by the success stories of Silicon Valley giants born on the internet, like Google, Amazon and Facebook. The digital powerhouses harvest vast amounts of user data using clever software for search, social networks and online commerce. Data is the fuel, and algorithms borrowed from the tool kit of artificial intelligence, notably machine learning, are the engine.

The early commercial use for the technology has been to improve the odds of making a sale — through targeted ads, personalized marketing and product recommendations. But big-data decision-making is increasingly being embraced in every industry, and to make higher-stakes decisions that crucially affect people’s lives — like helping to make medical diagnoses, hiring choices and loan approvals.