Keep the treats hidden in a hand or on the table in a bag, or between your crossed legs, or whatever. The only expectation he has of getting the treat is by hearing the click first. When he is doing something, and he hears that click, his brain will instantly file that information, and he will work to repeat the behavior which he was performing at the instant he heard the click. Let's say you want to teach the dog to sit. The instant his cute little butt plops on the floor, you click, then give him his treat.
Timing is critical.
If you are late, don't click. You have lost the opportunity to reward THAT SIT forever. There will be more sits. Just be careful to reward them when they happen. Novices need practice developing their timing.