I am struggling to understand the grammar behind the sentence "Sé el primero al que le gusta esto", and in particular that construction "el primero al que". I understand "que" to here mean "that" or "who", and the "a" is simply the personal "a", but I cannot see past a literal translation of "the first the who". Why is it not simply "Sé el primero a que le gusta esto"?
The word que is a relative pronoun (equivalent to the English word that).
In normal use you must put it together after the other word which makes the syntactic relation. (This is not entirely true, but it avoids complicating the explanation). For example:
El televisor que compramos está defectuoso.
The grammatical analysis is as follows:
Main clause: El televisor está defectuoso
Subordinate clause: que compramos
The subordinate clause can be expanded to el televisor compramos ("we buy a TV"), where the pronoun "que" replaces "televisor". That is the function of relative pronouns.
You cannot separate televisor from que.
Now consider your hypothetical sentence:
Sé el primero a que le gusta esto
In this case the preposition a is "sandwiched" between primero and que.
The solution is to use a slightly more complex pronoun. It seems as if we only add an article, but it is actually considered another type of relative pronoun, that agrees in gender and number with what it's related to:
el que, la que, los que, las que.
With this pronoun we can do more complicated things:
El que llegue primero ganará. [At the beginning of sentence]
Sé la primera a la que le gusta esto. [Preceded by a preposition]
Sé el primero a el que le gusta esto.
...but in this last case we merge a + el into one word al:
Sé el primero al que le gusta esto.
When referring to humans you can also use the pronoun quien, which works identically, but only agrees in number (not gender):
Sé el primero a quien le gusta esto.
Sean los primeros a quienes les gusta esto.
The most usual relative pronoun for people is "que".
Sé el primero que hace clic.
But, as we are using the pronoun in the I.O. (because "gustar" asks for it), we find ourselves with a preposition.
After a preposition, the presence (as opposed to the absence) of an article depends on several things:
- Explanatory clause, mandatory: Mi marido, al que le gusta eso, dice...
- Restrictive clause, depends:
- Non person: different rules, depending on whether it's a, de, con, en , por; whether it's affirmative or emphatic... Not our case here.
- Person, mandatory. <- Our case.
Source: DPD, "que", 1.2.2
It can be just que. The "short" prepositions — a, de, con — allow for the omission (or perhaps better said, elision) of the article.
The reason the article is needed is because all prepositions in Spanish must have a noun or something acting as a noun following them. Proposition standing, common in English, is verboten.
A que clause you see is actually an adjective clause, though. To nounify adjectives, in other words, to say a thing that is that adjective, we place an article in front.