reference request: models of how racism or sexism affects decision making
There is a large literature on this, particularly in the context of labour markets. Some classic references:


Becker (1957) analyses employers who care about making profits
but also seek to avoid interacting with certain groups. One famous
result is employer prejudice need not lead to racial wage gaps as
long as there are enough non-prejudiced employers to hire the
minority group.
Phelps (1972) models employers who use demographic information
(e.g. gender or race) as proxies for unobserved but productivity
relevant variables. Unsurprisingly, it turns out that differences in
means or variances across demographic groups can induce employers to
discriminate in this setting.
Similar models are developed by Arrow (1971) and Aigner and
Cain (1977). I would particularly recommend reading the latter.
Here are some lecture notes which provide a useful overview of
some of the main issues and ideas.