Updated!
If you use any kind of modern technology to write, it's a good idea to take the point of view of a cynic, as defined by Ambrose Beirce: a person who sees things as they are, not as they ought to be.
My own rule when it comes to technology is that it's not a question of if something is going to go wrong, but when. Unfortunately, it's a rule that has not failed me yet. So, how can you avoid losing your work when your laptop crashes, your computer gets a virus or somebody steals your mobile?
Save as you go
If you use Word, you can save your file automatically as you work. All you need to do is use the AutoSave function, which I explained here: Autosave.
If your word processor doesn't have an autosave function, then save it manually. I save my work after typing each paragraph. If you're not as paranoid as I am, save it every ten minutes, or at least every time you get up from the computer or break off writing to answer a phone call. In my opinion, every ten minutes or even more frequently is preferable, because it means that should disaster strike you will 'only' lose ten minutes'-worth of work, not several hours'.
Save or export to the cloud
If you save everything to your device, then even if you have been very assiduous in saving your work often, you will lose it all if your device gets stolen or broken. Therefore either save to the cloud as you go, or export it to the cloud at some point.
For example, when I'm working on my laptop, I save to iCloud, which is Apple's cloud service. It's not foolproof, as I discovered recently when I tried to pick up my work on a pc (see A big problem with iCloud). But that was a minor inconvenience compared to losing my work altogether.
When I use Jotterpad, I save my work to Dropbox, which gives you a lot of storage space for free. If I'm writing somewhere that doesn't have wi-fi, I save my work locally (ie to my device), and then upload it Dropbox later.
Backup
Buy an external hard drive or a high capacity SD card or USB stick and backup your work to that too. At the end of every writing session at home I back up my work to an external hard drive. It means that if my computer refuses to boot up or something, I can still retrieve my work.
I've tried a lot of backup utilities in my time, but my absolute favourite is Copiaris. The two things I like about it most are as follows.
First, it saves files in their native format, not some special proprietary format. What that means is that if my Copiaris program becomes corrupted or unavailable, I will still be able to open up the backup files created with it.
Secondly, you can set it to save versions. So that means that if I back up my magnum opus today, and then do so tomorrow, tomorrow's backup won't overwrite today's. That's handy because if the day after tomorrow I decide that what I wrote tomorrow is rubbish, I can simply load up today's version and carry on as if nothing has happened.
Email yourself
One thing you can do is to email your document to yourself. I don't think this is good enough on its own. Why not? Well, partly because it's easy to lose track of attachments in emails, and partly because if something goes wrong with your mail server you could potentially lose all your emails -- including the ones with your life's work in it. You could even accidentally delete it yourself. But if push comes to shove, it's better than nothing.
Print it
If you don't wish to do any of the above (or even if you do), you can always print out your document, or the latest additions to it, every day. It means that if you lose every single digital version of your document, you will at least have a print-out, which will save you from having to remember everything you wrote. You can either type out the document again (or pay someone else to do so) or employ a scanner and Optical Character Recognition (OCR) software.
What you will be doing is taking a photo of the document (with the scanner), and then using the OCR software to recognise the patterns in the photo as letters, and so turn them into editable text.
This method is both laborious and prone to error, but if you've lost the digital version of your 300 page masterpiece then it's a good option to know about.
Conclusion
Don't make the mistake of thinking that a worst case scenario will never happen to you. It can happen to anyone, no matter how careful they are. Just take the view that the gods are out to get you, and you should be in a much stronger position!