Counting cards refers to the practice of keeping track of the cards that have gone by while playing a card game, usually in a
casino. There are many widely varying methods of card-counting, with different degrees of difficulty and different purposes. Most casino games are designed so that the house has the advantage, but if you're good at counting, you can make a lot of money from the casinos. That's why they
disallow it.
In Rain Man, Raymond has a phenomenal ability to count objects (such as a box of fallen toothpicks with perfect precision) as well as a superhuman memory. On noticing this, his brother got the idea to teach him blackjack and take him to Las Vegas.
It should be noted that with a very simple card-counting scheme, blackjack can be made favorable to the player. All you have to do is to keep a single number ("the count") in your head, and increment it for every low card (2-6) and decrement it for every high card (10-A). This lets you keep track of the relative number of high and low cards remaining in the deck. The idea is that when there are a lot of high cards in the deck, the dealer is likely to bust and all players win.
To use this to your advantage, play with an unaltered basic strategy and vary your bet according to the count: bet the minimum most of the time, and when the count is large (especially near the end of a shuffle), increase your bet. By betting low when the game is in the house's favor and high when the game is in your favor, your expectation is positive. Take note, though, that a positive expecation is no guarantee. The odds are in your favor, but that doesn't mean you won't lose--so don't ever make a bet you can't afford to lose.