this is probably not the problem but hey who knows
does it happen every time you shift? or only under certain conditions. When you shift gears, the chain has a hard time changing under a lot of stress (i.e. out of the saddle pedaling) sometimes it might help to break your cadience for a second to get in a slower easier pedal to change gears, and then pick it back up again.
of couse if you have a part problem this is kinda irrelevant