Most companies choose their customers. Some merely do so as a side-effect of their cost structure and the priorities their sales people apply, other (particularly service-oriented) companies might review during the initial contact whether their way of working suits the structure of the potential client.
Some also choose on the basis of their beliefs.
Cloudflare posted an article after dropping the daily stormer as a client, explaining the trigger reason, their process, and the overall issues with considering such things. It’s very thoughtful.