I don't think anyone decides that as such. Organizations and individuals decide who they do or don't want to associate with. If it turns out that very few people want to associate with you, then you've been ostracized. Your question is like asking "Who decides which people should be friends?", or "Who decides who should be popular?"
Hmm? There are laws against some forms of discrimination, but organizations have freedom of association just as individuals do. For example, political affiliation is not a protected class, so (in some states and some contexts) it is perfectly legal for a private company to decline to hire someone on the basis of their political views.
Thinking in terms of the US constitution and the laws built on top if it, ostracization by the government is forbidden and ostracization by private citizens and entities is not.
> ostracization by the government is forbidden and ostracization by private citizens and entities is not.
So its fine to fire all black people to ostracize them? No, of course not, so no you are wrong here, there are more limitations than that, people have rights protecting them from a lot of ostracism.
> This works because people can choose to not be jerks, but they can't choose to not be black.
What if they could? People can change gender identity nowadays, and it's not outside the realm of possibility that people could change their phenotypical characteristics (transracialism is a hotly debated topic).