There are 3 “standard” situations of contrast: the intro, the secondary theme, the “B” section , or trio. There is still the contrast as a result of immediate interruption of the exposition as well. This is what i handled in my live composing no.2 . But the best tip i can give you is what my teacher of composition Christian Ofenbauer (student of Friederich Cerha) said:
master the variated development first, later the contrast.
Most of the time the contrast is used as “copying” for lack of technique: it is an evasion towards outside of the purpose of the music.
The constrast has to be seem many times an intentional problem. Therefore the most important thing is in the cases I find the most interesting not the contrast and the previous section, but what comes after it as the resolution of a problem.