I think it is because people instinctively want to try and get some kind of control (even illusory) over the situation happening again.
To do that, they have to try and think of common 'human being ingredients' that allow them to predict things like this happening (so that they can be prevented in future).
Unfortunately all the most obvious, profound ingredients are the ones that will be looked at first, regardless of whether or not they actually have any bearing... his gender, colour, age group, religion, mental health status, etc etc etc.
People will look at all these things and they will try to find patterns, the same way we do when we look at diseases to diagnose... what are the symptoms? what are the signs?
The process will inevitably be crude and flawed and blunt, and dangerous if then extrapolated into views of 'well all people from that group must behave that way'.
But its a process that needs to be done, it just needs to be done carefully and sensitively, and with awareness that the variables are incredibly, incredibly complex, and that nothing is black and white.