The same way it happens in the league?
I read a piece in the last 48 hours where a former Vandy pitcher was talking about this very thing. In his bit he was talking about how a guy can be in the pen throwing 98, right down the middle, and then get to the mound and can't find the zone.
I don't know if anyone, ever, has accurately diagnosed what causes the 'yips." I do know they haven't found a "cure."