In western music, a motet is a mainly vocal musical composition, of highly diverse form and style, from the late medieval era to the present. The motet was one of the pre-eminent polyphonic forms of Renaissance music. According to Margaret Bent, "a piece of music in several parts with words" is as precise a definition of the motet as will serve from the 13th to the late 16th century and beyond. The late 13th-century theorist Johannes de Grocheo believed that the motet was "not to be celebrated in the presence of common people, because they do not notice its subtlety, nor are they delighted in hearing it, but in the presence of the educated and of those who are seeking out subtleties in the arts".
In the early 20th century, it was generally believed the name came from the Latin movere ("to move"), though a derivation from the French mot ("word", or "phrase"), had also been suggested. The Medieval Latin for "motet" is motectum, and the Italian mottetto was also used. If the word is from Latin, the name describes the movement of the different voices against one another. Today, however, the French etymology is favoured by reference books, as the word "motet" in 13th-century French had the sense of "little word". In fact, the troped clausulas that were the forerunner of the motet were originally called motelli (from the French mot, "word"), soon replaced by the term moteti.
The earliest motets arose in the 13th century from the organum tradition exemplified in the Notre Dame school of Léonin and Pérotin. The motet probably arose from clausula sections in a longer sequence of organum. Clausulae represent brief sections of longer polyphonic settings of chant with a note-against-note texture. In some cases, these sections were composed independently and "substituted" for existing setting. These clausulae could then be "troped," or given new text in the upper part(s), creating motets. From these first motets arose a medieval tradition of secular motets. These were two- to four-part compositions in which different texts, sometimes in different vernacular languages, were sung simultaneously over a (usually Latin-texted) cantus firmus that once again was usually adapted from a passage of Gregorian chant. It is also increasingly argued that the term "motet" could in fact include certain brief single-voice songs.  The texts of upper voices include subjects as diverse as courtly love odes, pastoral encounters with shepherdesses, political attacks, and many Christian devotion, especially to the Virgin Mary. The vast majority of medieval motets are anonymous compositions, and there is significant re-use of music and text. They are transmitted in a number of contexts, but were most popular in northern France and Paris; the largest surviving collection is in the Montpellier Codex.
Increasingly in the 14th and 15th centuries, motets made use of repetitive patters often termed panisorhythmic; that is, they employed repeated rhythmic patterns in all voices—not only the cantus firmus—which did not necessarily coincide with repeating melodic patterns. Philippe de Vitry was one of the earliest composers to use this technique, and his work evidently had an influence on that of Guillaume de Machaut, one of the most famous named composers of late medieval motets.
Other medieval motet composers include:
The motet was preserved in the transition from medieval to Renaissance music, but the character of the composition was entirely changed. While it grew out of the medieval isorhythmic motet, the Renaissance composers of the motet generally abandoned the use of a repeated figure as a cantus firmus. Guillaume Dufay was a transitional figure in this regard; he wrote one of the last important motets in the medieval, isorhythmic style, Nuper rosarum flores (1436), written to commemorate the completion of Filippo Brunelleschi's dome in the Cathedral of Florence. During the second half of the fifteenth century, motets came to adopt the cantus firmus technique found in contemporary "tenor masses," in which the cantus firmus was stretched out to great lengths compared to the multivoice counterpoint surrounding it. This tended to obscure the rhythm supplied by the cantus firmus that had been apparent in the medieval isorhythmic motet. The cascading, passing chords created by the interplay between multiple voices, and the absence of a strong or obvious beat, are the features that distinguish medieval and renaissance motet styles. Instead, the Renaissance motet is a polyphonic musical setting, sometimes in imitative counterpoint, for chorus, of a Latin text, usually sacred, not specifically connected to the liturgy of a given day, and therefore suitable for use in any service. The texts of antiphons were frequently used as motet texts. This is the sort of composition that is most familiarly designated by the term "motet", and the Renaissance period marked the flowering of the form.
In essence, these motets were sacred madrigals. The relationship between the two forms is most obvious in the composers who concentrated on sacred music, especially Giovanni Pierluigi da Palestrina, whose "motets" setting texts from the Canticum Canticorum, the biblical "Song of Solomon", are among the most lush and madrigal-like of Palestrina's compositions, while his "madrigals" that set poems of Petrarch in praise of the Blessed Virgin Mary would not be out of place in church. The language of the text was the decisive feature: if it is Latin, it is a motet; if the vernacular, a madrigal. Religious compositions in vernacular languages were often called madrigali spirituali, "spiritual madrigals". Like their madrigal cousins, Renaissance motets developed in episodic format, with separate phrases of the source text being given independent melodic treatment and contrapuntal development; contrapuntal passages often alternate with monody.
Secular (non-religious) motets continued to be written, however. These motets typically set a Latin text in praise of a monarch, commemorating some public triumph, or even praising music itself. Nevertheless, the themes of courtly love often found in the medieval secular motet were banished from the Renaissance motet. Many secular motets are known as "ceremonial motets". Characteristic of ceremonial motets was a clarity of diction, for the audience was not presumed to be familiar already with the text (as would have been true with Latin hymns) and also a clear articulation of formal structure, for example a setting apart of successive portions of text with sharp contrasts of texture or rhythm. Adrian Willaert, Ludwig Senfl, and Cipriano de Rore were among the most prominent composers of ceremonial motets during the first half of the 16th century.
The motet was one of the preeminent forms of Renaissance music. Important composers of Renaissance motets include:
In the latter part of the 16th century, Giovanni Gabrieli and other composers developed a new style, the polychoral motet, in which two or more choirs of singers (or instruments) alternated. This style of motet was sometimes called the Venetian motet to distinguish it from the Netherlands or Flemish motet written elsewhere. "If Ye Love Me" by Thomas Tallis serves the demand of the Church of England for English texts, and a focus on understanding the words, beginning in homophony.
In Baroque music, especially in France, there were two distinct, and very different types of motet: petits motets, sacred choral or chamber compositions whose only accompaniment was a basso continuo; and grands motets, which included massed choirs and instruments up to and including a full orchestra. Jean-Baptiste Lully was an important composer of this sort of motet. Lully's motets often included parts for soloists as well as choirs; they were longer, including multiple movements in which different soloist, choral, or instrumental forces were employed. Lully's motets also continued the Renaissance tradition of semi-secular Latin motets in works such as Plaude Laetare Gallia, written to celebrate the baptism of King Louis XIV's son; its text by Pierre Perrin begins:
Plaude laetare Gallia
Rore caelesti rigantur lilia,
Sacro Delphinus fonte lavatur
Et christianus Christo dicatur.
("Rejoice and sing, France: the lily is bathed with heavenly dew. The Dauphin is bathed in the sacred font, and the Christian is dedicated to Christ.")
In Germany, too, pieces called motets were written in the new musical languages of the Baroque. Heinrich Schütz wrote many motets in series of publications, for example three books of Symphoniae sacrae, some in Latin and some in German.
Johann Sebastian Bach wrote works he called motets, relatively long pieces in German on sacred themes for choir and basso continuo, with instruments playing colla parte, several of them composed for funerals. Six motets certainly composed by Bach are:
The funeral cantata O Jesu Christ, meins Lebens Licht, BWV 118 (1736-37?) is regarded as a motet. The motet Sei Lob und Preis mit Ehren, BWV 231 is an arrangement of a movement from Bach's Cantata 28, and the authenticity of the arrangement is not certain. For a few more motets, such as Ich lasse dich nicht, BWV Anh 159, Bach's authorship is debated.
Later 18th-century composers wrote few motets, but for example his son Johann Christoph Friedrich Bach composed an extended chorale motet Wachet auf, ruft uns die Stimme, combining Baroque techniques with the galant style. Mozart's well-known Ave verum corpus (K. 618) is in this genre.
In the 19th century, some German composers continued to write motets. Felix Mendelssohn composed motets such as Jauchzet dem Herrn, alle Welt and Denn er hat seinen Engeln befohlen. Johannes Brahms composed for example three motets on biblical verses, Fest- und Gedenksprüche. Josef Rheinberger composed motets such as Abendlied. Anton Bruckner composed about 40 motets, mainly in Latin, including Locus iste. French composers of motets included Camille Saint-Saëns, and César Franck. Similar compositions in the English language are called anthems, but some later English composers, such as Charles Villiers Stanford, wrote motets in Latin. The majority of these compositions are a cappella, but some are accompanied by organ, for example Edward Elgar's three motets Op. 2.
In the 20th century, composers of motets have often consciously imitated earlier styles. In 1920, Ralph Vaughan Williams composed O clap your hands, a setting of verses from Psalm 47 for a four-part choir, organ, brass, and percussion, called a motet. Carl Nielsen set in Tre Motetter three verses from different psalms as motets, first performed in 1930. Francis Poulenc set several Latin texts as motets, first Quatre motets pour un temps de pénitence (1938). Maurice Duruflé composed Quatre Motets sur des thèmes grégoriens in 1960. Other examples include works by Richard Strauss, Charles Villiers Stanford, Edmund Rubbra, Lennox Berkeley, Morten Lauridsen, Edward Elgar, Hugo Distler, Ernst Krenek, Michael Finnissy, Karl Jenkins,Arvo Pärt,Sven-David Sandström,Enjott Schneider, Ludger Stühlmeyer,Pierre Pincemaille,  and Igor Stravinsky.