How to completely reset my iPhone?

I'm selling my iPhone. I've tried to reset it in the General settings but all i get is "The Connection to iCloud timed out".

I've also tried to restore it on the computer. But it says, "Go to iCloud settings on your iPhone and turn off find my phone before restoring your phone"

So then try it. Tells me to type in my ID password. But then comes up with the message "The connection ti iCloud timed out".

I'm not sure if its because the iCloud is using my old email address/ID Username.

Added (1). I've also tried to Sign out of iCloud. But got that message again 'iCloud timed out"

To Reset An Iphone I Think You HAVE TO KNOW THE ID PASSWORD for security reasons. Could Be Wrong Though, But If Not You Could Try A Phone Repair Or Carrier Store