In this example in A major when the chord progression reaches E7 I play A melodic minor scale over the E7 chord giving it a jazz like sound.
The simple theory behind it is E7 is the 5 chord for for both A major and A melodic minor so either scale will work giving you a different sound.