How securely can you virtually erase hard drives and flash drives?

How securely can you virtually erase hard drives and flash drives without destroying them? What are the differences between SSDs and HDDs? Who else can recover the data? Which apps can securely delete data, and which might be able to restore it? How secure is secure deletion in Disk Utility on macOS?