The word 'fugue' means 'to flee'. When applied to music, it describes a contrapuntal convention used by many composers to provide a special flavor to a musical composition. This should not be confused with the psychological term fugue state.
Fugues are generally described as being in three or more parts (there have been rare instances of a two-part fugue, however). Each 'part' represents a melodic voice used in the fugue.
Fugues feature a subject, and may feature a counter-subject that occasionally plays while the subject is playing. The subject is a small musical phrase or theme.
If a fugue has a second subject, it is said to be a double-fugue.
Fugues always start with the subject played by the first voice. At some point after the first voice has started, the subject is played against by the second voice in another musical mode. Thereafter, the next voice enters with the subject in a different musical mode from the prior voice, and so on until all voices have played the subject.
This describes a fugue's introduction.
A fugue may then play a bridge (where the subject is not heard at all), or it may enter into an exposition, where the subject is continuously played in various modes, ornamentations, inversions, retrogrades, or other music tricks (perhaps with an occasional bridge). The final stage of a fugue is the "recapitulation" where the subject is repeated in the manner it was first introduced (using the same musical mode and without any ornamentations). This eventually leads to the end of the fugue.
Fugues are not a true musical form, so much as a musical convention. This is reflected in the experimentation with fugue compositional techniques by jazz composers in the 20th century. While all fugues have an introduction, they may not have the other sections described above.
The 18th century composer Johann Sebastian Bach is generally regarded as the greatest composer of fugues. He often entered into contests where he would be given a subject with which to spontaneously improvise a fugue on the organ or harsichord.
"Row, Row, Row Your Boat" is sometimes mistaken for a fugue, but it is actually a round, as the subject is identical for all four voices, and they repeat the subject in the same mode and key.