The fight or flight response increases the heart rate via its effects on the sympathetic nervous system. When you sense fear or danger, the amygdala in you brain is triggered. The activated amygdala then triggers another part of the brain called the locus coeruleus, which then activates the sympathetic nervous system. The activated sympathetic nervous system then activates the heart to beat faster and contract more forcefully. See the following diagram for how the fight or flight response increases heart rate:
