The remote server returned an error: (401) Unauthorized.

When your CSOM scripts in SharePoint 2013 fails with the error message "The remote server returned an error: (401) Unauthorized."
 
The resolution is to add new settings in web.config of your web application.
 
<appSettings>
        <add key="aspnet:AllowAnonymousImpersonation" value="false" />
    </appSettings>
 
Happy SharePointing :-)