I'm revising my answer, because from OP comments I now understand the question isn't simply about Riemann function.
I see potentially three definitions for "function": Riemann function, mathematical function, function meaning purpose.
...But I wonder how you would explain it to a curious student...
To the extent there is a problem, that problem seems to be with the word "it." "Explain it." Explain what exactly? Explain Riemann function? Explain a math-like function concept in music? Explain the purpose (function) of musical devices? If the word "function" is used with students, and we switch back and forth between the various meanings of the word, some students might get confused.
Personally, when I hear "function" in musical context I think either Riemann function or the general meaning purpose. I don't think of the math term which in plain English means something like procedure. If someone is confused about the meaning of "function," you probably need to clear up which definition is being used.
As far as the math meaning is concerned, I like the example sentence: "the position of a planet is a function of time." We could apply that to some musical processes and add the general meaning purpose.
The inversion of a melody is a function of direction and melodic inversion is used to develop new, thematically related material. An inversion function would take a series of intervals and directions and return the same set of intervals with all the directions reversed.
A harmonic sequence is a function of transposition and sequential harmony can be used to move to a new key. A harmonic sequence function would take a two chord progression and an interval of transposition and return the original two chords followed by two more chords whose roots are located the interval of transposition away from the original two chords.
Syncopation is a function of rhythm and syncopated rhythm is used to create excitement. A syncopation function could take a melodic fragment and change metrical rhythmic patterns to contra-metric values without changing the pitches.
So from these examples, to invert, to sequence, and to syncopate are all functions in the mathematical sense that output of the process is determined by the input. In plain English these functions are all verbs.
Can Reimann function be described as a function in the mathematical sense that the output of such a function is determined by the input? I say "no."
We really understand a chord's Riemann function only after knowing where the chord goes. If the 'input' is chords
C G Am ...what would a Riemann function determine is the output? Riemann function is about the succession of chords. Any sensible Riemann function process would provide the next chord as output. But, we don't know where the music is going. It could modulate. More importantly we have know way to if the next chord should be functional according to Riemann function. In other words: Riemann function is not a musical procedure - the mathematical meaning of function - but a description of existing harmony.
...What does “function” actually mean in music?
To the extent that 'function' in music will be understood by some as 'Riemann function' it is merely a description of harmony. Music can be described as functional or non-functional.
...I remember when the term function was introduced in math - y=f(x)
Riemann function is not one of those functions.
...tonic and dominant also are functions...
No, they aren't. If we use the mathematical meaning of function, tonic and dominant are not processes. They are properties of chords in the Riemann model. We could have a mathematical function called tonicize but that is something different. After applying a tonicize function to a chord we could then refer to the chord's tonic property and it being the tonic of a tonality.
So, if we really want to be mathematical about this, the common musical concept of "a chord's function" is a property, a description, an adjective. It is not a mathematical function, it isn't a process, it isn't a verb.
My original answer...
I suppose it works like this in my mind:
Example, there are chords
I can place them into a key
The (Riemann) functions are basically the chord root identities labelled with Roman numerals
vi, further I can give general labels of pre-dominant, dominant, and (I selected
vi on purpose) a non-tonic chord which gets' shoe-horned into the Riemann function system as another pre-dominant. If the
Am had been
C we would have the tonic and very neatly fulfilled the expected Riemann functions...
Riemann function is also described as a flow of events: pre-dominant, to dominant, to tonic.
Depending on the rhythmic phrasing I could say the harmony forms a deceptive cadence.
Normally, that is the end of the Riemann analysis story.
But, as I understand the question, the issue is not about the labels, but rather "what is the purpose fulfilled by the functions?"
So, in the Riemann sense: "what is the function of harmony?" answer "to lead to and form a cadence."
Notice that I specify cadence and not chord progression.
If we take something like
V6 IV6 iii6 ii6 I6/4 V7 I, the initial chords in the progression don't fulfill Riemann function, but the ending does. To me, the essential functional part is the cadential part. Something similar could be said about sequential harmony where the sequential passage is a shifting of the tonal center - indeed, pivot chords get two labels - after the sequence a cadential passage confirms tonality at which point function becomes clear.
Whether any of this is satisfying intellectually or musically is another matter. My attitude about functional harmony - and harmony textbooks - changed a lot after I read Gjerdingen's Music in the Galant Style which turned me on to figured bass and solfege. Why should Riemann function trump rhythm and metrical function, or the function of consonance/dissonance and stability/unstability? All of which get's short shrift in most textbooks compared to Roman numeral analysis. "What's the function of a chord or harmony?" Answer: "to express yourself musically!" "Why does some music lead to cadences?" Answer: "because that is the convention is those styles!"