structural:summarization
In classical music, a fugue (/ f juː ɡ /, from Latin fuga, meaning "flight" or "escape") is a contrapuntal, polyphonic compositional technique in two or more voices, built on a subject (a musical theme) that is introduced at the beginning in imitation (repetition at different pitches), which recurs frequently throughout the course of the composition. It is not to be confused with a fuguing tune, which is a style of song popularized by and mostly limited to early American (i.e. shape note or " Sacred Harp ") music and West Gallery music. A fugue usually has three main sections: an exposition, a development, and a final entry that contains the return of the subject in the fugue's tonic key. Fugues can also have episodes, which are parts of the fugue where new material often based on the subject is heard; a stretto (plural stretti), when the fugue's subject overlaps itself in different voices, or a recapitulation. A popular compositional technique in the Baroque era, the fugue was fundamental in showing mastery of harmony and tonality as it presented counterpoint.

In the Middle Ages, the term was widely used to denote any works in canonic style; however, by the Renaissance, it had come to denote specifically imitative works. Since the 17th century, the term fugue has described what is commonly regarded as the most fully developed procedure of imitative counterpoint.

Most fugues open with a short main theme, called the subject, which then sounds successively in each voice. When each voice has completed its entry of the subject, the exposition is complete. This is often followed by a connecting passage, or episode, developed from previously heard material; further "entries" of the subject are then heard in related keys. Episodes (if applicable) and entries are usually alternated until the final entry of the subject, at which point the music has returned to the opening key, or tonic, which is often followed by a coda. Because of the composer's prerogative to decide most structural elements, the fugue is closer to a style of composition rather than a structural form.

The form evolved during the 18th century from several earlier types of contrapuntal compositions, such as imitative ricercars, capriccios, canzonas, and fantasias. The Baroque composer Johann Sebastian Bach (1685–1750), well known for his fugues, shaped his own works after those of Jan Pieterszoon Sweelinck (1562–1621), Johann Jakob Froberger (1616–1667), Johann Pachelbel (1653–1706), Girolamo Frescobaldi (1583–1643), Dieterich Buxtehude (c. 1637–1707) and others. With the decline of sophisticated styles at the end of the baroque period, the fugue's central role waned, eventually giving way as sonata form and the symphony orchestra rose to a more prominent position. Nevertheless, composers continued to write and study fugues; they appear in the works of Wolfgang Amadeus Mozart (1756–1791) and Ludwig van Beethoven (1770–1827), as well as modern composers such as Dmitri Shostakovich (1906–1975) and Paul Hindemith (1895–1963).