A naive mathematician might misinterpret this question to ask about the probability of getting 6 heads in row. If the sixth flip is a head, that makes 6 heads in a row. Because the probability of a head on any one trial is .5, and trials are independent, the probability of six in a row is .5 times itself 6 times = .016. So they guess the probability to be much less than .50.
Or they could mistranslate the question from "what is the probability of a head on the next flip" to "what is the probability of getting 5 heads in a row and then another head."
In fact the question just asks, about the 6th flip. It does NOT ask, what is the probability of getting six heads in a row. Mathematically, these are two different events.
The skeptical statistician (a Bayesian) would look at the data already provided --5 consecutive heads-- and use this data to test the hypothesis that the coin was unbiased and/or the flips were random.
In fact, if the coin is unbiased and the flipping random, the binomial formula will show that getting 5 heads in row would occur (by chance) only 3% of the time. This is a statistically significant result, so the skeptical statistician concludes something is fishy, the coin or its flipping must be biased towards heads. He/she predicts that the probability of next flip, given the coin's past history, is greater than .50. This is the most sophisticated answer because it makes maximal use of the information given.
Wouldn't regression to mean predict the coin is likely to come up tails?
In statistics class, you probably heard about regression towards the mean-- that observations/events which are extreme at one point in time (or on one aspect) will be less extreme at another time or on another dimension.
With the assumption of an unbiased coin and unbiased coin flipping, regression to the mean does predict that the next 6 flips would have fewer heads than 5 or 6. But you would still predict "3 out of the six will be heads" because predicting the mean (or expected value) is the best prediction for chance outcomes because that's what value chance outcomes regress towards.
If you think regression requires fewer than 3 heads to counter the 5/6 that occurred in the first 6 flips, you are falling prey to the gambler's fallacy again! Regression to the mean results in the number of heads (or proportion) being less extreme or closer to the theoretical mean on the next six flips, but not necessarily less than the mean.
Of course, over 100 sets of 6 flips, there will be some sets where only 1 or 2 heads appear, but regression to the mean does not guarantee those sets with a low number of heads will always occur. Regression only dilutes the impact of extreme outcomes, it does not counter them.
As you can see, how one construes the problem influences what reasoning is correct. However, the gambler's fallacy could be correct only if two events have a hydraulic or complementary relationship over time. There are few such relationships in nature. So, despite the many clever and humorous sayings which exemplify the idea, such as "no good deed goes unpunished," this belief is usually wrong and represents a kind of magical thinking.