Police are trying to find out what motivated the attacker behind one of the deadliest mass shootings in recent US history.