If you have a poor connection for whatever reason & the download keeps failing, then you can separate the two tasks, Download from Restore, by manually fetching the ipsw file from Apple's servers.
The links are all maintained on https://ipsw.me/signed - the actual files come directly from Apple & so are safe to download, the site merely lists the direct download locations.
If you are uncertain as to the correct file to download, then check the name against your previous ipsw file, which iTunes should have stored at
~/Library/iTunes/iPhone Software Updates/
with a file name, for example of
...then you look for the v9.3.2 of that particular device on ipsw.me [assuming your device is new enough to support iOS 9]
You then copy your new ipsw file to the same location as your old one, erase the old & go for the restore again. It will find the correct file & work from that.