The mechanism is simple and seductive. Each adjustment that improves the backtest is made because it improved the backtest, so the result is a description of that specific sample. Add enough rules and you can make any history profitable, including a random-walk.
Tell-tale signs: parameters at oddly specific values, rules that exclude particular dates or instruments, more conditions than the strategy has independent trades to justify, and a sharp performance cliff when a parameter moves slightly. Compare against a parameter-plateau, where nearby values behave similarly.
The defences are all about restraint: fewer rules, fewer parameters, a reason for each that exists outside the data, a holdout-set you look at once, and walk-forward-analysis rather than a single fitted period. None of them prevents curve fitting; they only make it visible.
Related: overfitting, degrees-of-freedom, parameter-plateau, data-snooping