Before starting it's important to note that this scenario can be entirely avoided by backing up data remotely. This can be through other devices such as a spare flash drive, or cloud based services. If your data is backed up, then this scenario will never be an issue.
There are a few conditions to recovering lost files; corruption and formatting. Is a drive is corrupted, then it's likely that any data on the drive will be at least partially corrupted too. It could be bad sector corruption, such as from the drive being old or moved during write, which means that data loss will be minimal. If the drive is fully corrupted, then it would be best to contact an expert service to have the files recovered; it may require replacing parts within the drive.
Formatting is different, a drive can be formatted and the data still recovered if the format was a quick format. Quick format basically wiped each sector of the drive, meaning the space still has a remnant of the data image. The sectors here are not fully cleaned, it's just like deleting everything on the drive. Unfortunately, if the drive has been deep formatted then the data is likely lost to the home user. A deep format (otherwise known as a 2 or 3 pass format) wipes the drive, then fills each sector with data, and deletes it again for a set number of cycles. It is almost impossible to recover data like this at home without expert kit, so it would be best to refer to a data security company.
The first step to restoring deleted files is one which most people forget; check program memory for any versions of the file. Things like the recycle bin are easily overlooked, but can often have the deleted file in question. If not, then check the program which you made the file with; MS Word saves recent documents as default now, and older versions can be restored through Word itself.
If the file has been deleted from program records, the next step can be a little complicated for those unfamiliar with recovery programs. First, located where the file should be; flash drive, hard drive, cd etc. If the flash drive has a corrupted sector, then the format will show up as RAW instead of the usual FAT32 or NFTS. Before recovery, it is vital to convert the drive back to a readable format though devmgmt.msc or a third party GUI based program such as EaseUS.
Once the sector is readable, the next step shouldn't be too hard; run some recovery software. Be warned, this can take a few hours as bad sectors can cause skips in reading, but the process should be done within those hours. Another word of warning; be sure to pick a well reviewed recovery software, as some do not allow full recovery without extra payments. EaseUS is great for converting a RAW drive back to FAT without formatting, but their recovery program leaves alot to be desired. Use a Piriform product for the fastest free results, as Recuva is a great light program with full access for free.
Once recovery software has completed, set the restore location to a space away from the original directory and copy the files back over. It's as simple as that, and doing this can cause no further damage to the data or drive, so it's always worth trying before contacting the experts.