My son had a similar issue.
iPod Touch 5th Gen - iOS 9.3.5
The iPod restarted itself asking for it to be setup again. (Data, Passcodes, WiFi etc are still intact)
First thing is that it would not activate the iPod, so I had to plug it into iTunes and then it allowed me to activate it!
I was checking his other settings e.g. iCloud but when I went into that section it said I cannot do anything until I have accepted the 'Terms and Conditions', when I tried to accept them I got an error 'Unable to connect to server'. Previous posts suggested that I open 'Find my Friends' but that didn't work, it just took me straight back to the iCloud settings.
I noticed that his Date and Time were off so I readjusted them and everything kicked back into action. looks like apple servers don't like devices out of sync with their servers (some security thing)
Hope this post helps and not too long winded.