I feel most other answers tell you to make your story in a way where the racist character will fail or at least lose out due to their racism. This might make a good story but it is unfortunately not historically accurate for large parts of human history.
If you want historical accuracy then racist characters can be very successful in life. More accurately almost all very successful people were racist old white men (or whatever other group was dominant in the historical setting you are interested in.) Of course this turned out miserablybformiserably for most people in these societies and you can focus on these aspects.