Facebook Inc. Chief Operating Officer Sheryl Sandberg was the architect of a business strategy that built the social network from a fast-growing but wobbly startup into a global advertising juggernaut with a market value of more than half a trillion dollars.

But during five nightmarish days in March, she and her communications team couldn’t figure out how to address the public’s mounting outrage over allegations that political firm Cambridge Analytica had improperly accessed data on tens of millions of Facebook users. While...