Card counting is typically against House rules.
There's an interesting article on how security detect card counting[0]. My take is that it's not a science, instead the security/ pit boss' who spend significant time watching players would develop a 'feeling'.
[0] https://www.huffpost.com/entry/how-casinos-know-that-you_b_6...?