Start by pressing “undo” (ctrl+z on windows or cmd+z on apple) or shut down the workbook without pressing save.
If none of the above work, or if you pressed save after deleting the sum formula, you can simply recreate the sum formula as you would in any other Excel workbook.