Apple is donating $2 million to groups “working to rid our country of hate,” CEO Tim Cook said in an email to employees.