For example, in the following sentence
It is Mary that brought me this book.
Does "that" serve as a conjunction or pronoun or any other grammatical function? And Why?
I'll expand on BillJ and Araucaria's comments, though I'm not claiming they endorse any of what follows.
It’s part of the tiny subordinator class made up of whether, if, for, that and to, what traditional grammar used to call a subordinating conjunction: a relatively meaningless left-end marker required by syntax in certain constructions and optional in others. Its job is solely to introduce the relative clause that brought me this book.
The claim that it's a relative pronoun has long been proven wrong: it is the same marker of clause subordination as we find in content clauses, and the distinction between that and bare relatives is analogous to that between expanded and bare declarative content clauses, as in You said (that) you don’t want the toys.
It was this knife [with which he cut it].
*It was this knife [with that he cut it].
They gave the prize to the girl [that/who spoke first].
Who spoke first?
That spoke first?
Have you seen the book [that/which she was reading]?
She was reading which?
She was reading that?
It was that day [that/when she arrived].
She arrived when?
*She arrived that?
It was to this town [that/- she went].
*She went that?
It was for this reason [that/- she resigned].
She resigned that?
It was this way [that/- she controlled the crowd].
*She controlled the crowd that.
It wasn’t to you [that/- I was referring].
*I was referring that.
It also cannot be a complementizer because the element it introduces is not a complement.
complementizer A word that introduces a clause [...] which functions as complement to a verb or some other head. The items that, whether, if (in interrogative clauses), and for belong to this class.[...]It is narrower in meaning than subordinating conjunction or subordinator. (The Oxford Dictionary of English Grammar)
Since there is no head that it is specifically allowed by, it is clearly outside this definition.
So subordinator (or if you prefer traditional terminology subordinating conjunction) is the answer to your question.
John Lawler commented:
This is the construction often called an It-Cleft, or just a Cleft sentence. It's generated by rule from Mary brought me this book by cleaving the sentence with an auxiliary be and inserting a dummy it and a complementizer (or relative pronoun) that for the postposed clause. There are also Wh-Clefts, like What Mary brought me was this book, as well as other varieties.