I have been able to dodge a few attacks here and there in different battles, but by and large, the most effective thing to do to win a gym fight seems to be spam tapping my screen as fast as I possibly can. Is dodging effective, and if so, how can I use it effectively (i.e. can I dodge secondary attacks which generally do more damage)?
Dodging is definitely effective but hard to do in my experience. You can dodge both the fast/normal attack as well as the special attack. Simply move to the left or right after the screen flashes yellow. It's important to be on a good connection to get the timing right. I'm not too sure what the cue for a special attack dodge is though aside from the text bubble that shows up.
I found a useful video that shows dodging in action:
Yes. In fact, some people would argue it's even "too good". If you're good at it, you can defeat stronger Pokemon (within reason; there is a time limit after all) than yours and expend very few resources.
It's also particularly useful for Training up your own gyms. Prestige gained from training works somewhat like ELO, where it's based on the CP difference of the Pokemon fighting. You can gain a lot of prestige very quickly if you have lower CP Pokemon beat higher CP Pokemon.