In Hangover, Alan learns some of the patterns of blackjack to try to cheat the casino. He follows the cards coming out on the table and can estimate how likely he is to win a hand. This card counting technique is also glorified in the movie 21. However, the key loss of reality here is that this technique takes years to master, and it requires one to be extremely self-disciplined.
This is shown in '21' but in The Hangover, Alan magically learns the technique in hours, and the group has made their lost money back in the space of a night. The contrast between the two movies represents the poetic licence some directors take with a movie. In '21' we see the main characters attacked by the casino security after their ruse is discovered. The risk of cheating the system is represented, with some of the characters left with nothing after the team finishes the final game.
However, Alan and the hangover gang simply waltz out, with no consequence or representation of the toils of gambling. As a moviegoer, it is important to remember misrepresentations that filter gambling movies. For example, when Alan is paying attention to the cards, algebra, calculus, and complicated mathematical operations are flying in his mind. Card counting involves simple math skills, like add, minus, and divide.
With the gambling industry moves to using a continuous shuffler, no matter how hard a person tries to master card-counting skills, it no longer has an edge over the house. So, Blackjack is just a gambling game that involves basic strategies, and there is no way to predict the outcome.