Q: I have two sections of a piece of music and they must be in different keys with a modulating chord at the end of section 1 which fits both sections. Can you explain this to me please?
A: In music you will find chords (usually dominant chords i.e. 1,3,5,b7) that will allow you to modulate to new keys. For instance starting in the key of C you could have the progression C to A7 to D- to A7 to D-. This progression will most likely make you modulate to the key of Dminor. This doesn't mean that all dominant chords make you modulate. For instance you could have a progression in the key of C. C to A7 to D- to G7 to C. If this progression is played at a moderate to fast tempo the A7 will not modulate to Dminor. If you play this progression extremely slow the A7 will make you modulate to Dminor and the G7 will make you modulate back to Cmajor. So you can see that you can't always tell if you modulate just by looking at the chords in a piece of music. Tempo is an important consideration when judging modulation but the bottom line is you need to use your ear to tell you whether you have modulated. In order to develop this kind of ability I suggest you work on your aural perception. Ear Training One Note Complete would be a good book to start with.
Learning to hear modulations will take some time so don't expect to have this ability right away. Once you pass out of One Note Ear Training I would get the Secondary Dominants book which will help you learn many common modulations.