First thing's first - are you doing this on a computer? If so, back everything up so that you don't lose your photos, documents, etc... Once you're sure that you've got them (Smart Switch just does a great big copy) then try deleting them from your phone to free up space.
Uninstall any apps that you don't use and try the update again.
When you do a factory restore, once you log back in Google will try to reinstall all of your current apps so that might not help you out.
However - if you can clear enough space to to the upgrade, get up to Marshmallow THEN do your factory data reset to clear out all the old Lollipops. Do this before you log into your phone (and Google re-installs all your apps and wastes a ton of time).
You can do the FDR (factory data reset) from the boot/recovery menu before you log back in. This will make sure that everything is as clean as you can get it.
Good luck, and come back with any more questions!