Legality of Counting Cards:
Card counting is not illegal. A card counter is really just using his/her brain to decide on how to play a hand. Using superior skill can hardly be considered a crime. Of course, actual laws can vary in some jurisdictions.
On the other hand, a person using a mechanical or computer device to count cards may find themselves on the wrong side of the law.
Some jurisdictions do allow the casino to bar a card counter.