The Art of Tri Attacking
No need to attack on the swim. No one wins a tri on the swim. Nor in transition of non-drafting races. In both T1 and T2 you can gain a time advantage with efficient equipment changes but the opportunity to mentally weaken your opponent is minimal.
On the bike in a triathlon is different than bike racing. There are no legal packs. Riders are either red-lining for the entire leg or spinning at a set power output. You're either passing everyone slower than you or settled into your pace regardless of what your competition is doing.
The best place to attack is on the run leg.
When running even with a competitor there are four key places to deploy an attack with a boost of speed to leave your opponent and crush them mentally:
Pick up the pace coming out of a turn.
Power up a hill.
Stride out on a downhill section.
Pull away at a turnaround point.
An alternative attack can be implemented on an open stretch of road. After pacing behind or stalking an opponent you choose an object along the road to pick up the pace to catch and pass. In this situation select a mailbox, road sign, spectator, or tree. Pick up the pace and confidently stride by your competition. Run far enough ahead that the other tri cannot go with you. Sometimes all it takes is a stride or two to mentally break any connection between the two of you. A difference of 5 meters may seem like 500 meters to someone trailing in mentally willing themselves to catch you. It just won't happen.
Need proof? Watch an attack on the track in a 5K or 10K race, a ride up a mountain leg of the TdF, or watch the lead pack head up Heart Ache Hill in the Boston Marathon.
After you reach the distance difference you want, settle in to a comfortable pace until ready to attack again to improve another place closer to or higher up on the podium.