It'd be pretty simple.
1. The user logs into Spotify in the new device/setup.
2. Spotify asks: "Would you like to download all your previously downloaded tracks?
3. If the user presses "Yes", it just starts downloading all the tracks that were downloaded in the last setup.
This way, if the user switches phones, or does a factory reset, he can easily re-download all the tracks downloaded in the last setup.
Updated on 2019-08-07
Your idea was submitted a while ago and unfortunately didn't receive the amount of kudos needed to stay active in the ideas board (100 Kudos per year).
In order to keep the Ideas Exchange clearer I'll close this idea for now, but this doesn't mean Spotify rejected this idea.
If you think this is an idea which needs to be implemented, you're welcome to post it in a slightly different form 🙂
Have a nice day!