The concept of musical functions is foundational to musical analysis, and essential to the understanding of musical styles.
A musical function describes the role that a particular musical element plays in the creation of a larger musical unit. Function is tied very much to the idea of expectation: given a certain element in a certain context, what element(s) is/are likely to come next? Likewise, how does a given element fulfill or deny the expectations set by what came before it?
A musical function typically has two defining features: the characteristics of the musical elements that tend to belong to that function (what notes tend to be found in the chord, for example), and the kinds of elements (or functions) that tend to precede or follow it in a succession of musical elements. Note that this is entirely dependent on the typical patterns of a musical style. Different styles of music may exhibit different functions or different behaviors for the same functions. The study of function and the study of style are inextricably linked.
The two musical traits most commonly studied for their functional properties in Western art and popular music are harmony and form. The study of both harmonic functions and formal functions will lead to an understanding of harmonic and formal syntax: the norms or principles according to which musical elements are combined into meaningful and stylistically appropriate successions. The study of harmony or form, then, is not a matter of learning to label chords, phrases, and modules correctly. It is a matter of interpreting the role that chords, phrases, modules, etc. play in the larger context in which they are found. That, of course, requires fluency in identifying (and thus labeling) individual musical elements. But identification is only the beginning of a much bigger, and more interesting, process of analysis. And it is that analytical work that will lead to true understanding of the pieces of music analyzed, and the styles to which they belong.