As defined by Dek Terrell of Kansas State University in an article published in 1994 in the Journal of Risk and Uncertainty,
The “gambler's fallacy” is the belief that the probability of an event is decreased when the event has occurred recently, even though the probability of the event is objectively known to be independent across trials.”
In simplistic terms, the gambler's fallacy is believing that just because an event has just occurred it is unlikely to happen again even though any previous occurrences have no relation to the next one. A simple example is the tossing of a coin. There are two possible outcomes, heads or tails, and if you have just tossed the coin and it has come out tails then the chances of it being tails again are exactly the same as it was before the previous toss. The coin has no memory and has no idea that it was tails the last time so this has no effect on the next toss.
Another example is roulette, assuming that the the ball has landed on black the previous ten times the odds on it being black on the next spin are exactly the same as they were on every previous spin. However, most people are more inclined to bet on red simply because it hasn't come up recently but as with the coin toss a roulette wheel has no memory.
An example where previous occurrences do have an effect on future occurrences is in single deck blackjack. Assume that in the previous hand four aces had been dealt to the players, you now know there are no aces left in the deck and so the chances of you being dealt an ace are zero. You can then play accordingly.
A way to benefit from this is in horse racing. If the first three favourites have been beaten at a meeting then people are more likely to bet on the favourite in the next race simply because they believe it is time for a favourite to win. However, the horse in question doesn't know it is favourite and it doesn't know that the first three favourites have been beaten ! You can benefit by going against popular opinion because the price of the favourite is likely to be too short. The converse is also true, if the first three favourites have won then people are less likely to back the favourite because they feel it is time for a favourite to lose, but again, nobody has told the horse ! This is likely to be a good time to get a better than expected price on a favourite.