In English, if a noun is followed by of + another noun, and the whole construction is supposed to be definite, both nouns are preceded by a definite article. Thus, we say in English the president of the republic. (On the other hand, we also say the president of Ireland, but in the latter example, Ireland is definite by virtue of being a proper noun.)
In Irish, one definite article is enough to make the whole expression definite. Thus, we say Uachtarán na Poblachta, and Uachtarán na hÉireann – and these constructions are the exact equivalents of the president of the Republic, the president of Ireland, in English. The word Uachtarán is already definite, because it is followed by a definite genitive.
On the other hand, when used alone, it obviously takes the article, when definite: Uachtarán “a President”, an tUachtarán “the President”.
When such a construction as Uachtarán na Poblachta itself is put in a genitive position, the first noun in it does not change: áras Uachtarán na Poblachta “the house of the President of the Republic”, but áras an Uachtaráin “the house of the President”. When the word that requires genitive form is basically used as a preposition, the older possibility of putting even the first noun into genitive is possible: fad radhairc mo shúl, i dtreo Teilifíse na Gaeilge. (The latter I remember from a nineties issue of Feasta; back then I thought it was wrong and thought it should have been corrected into I dtreo Theilifís na Gaeilge, but now I know that both alternatives are correct.)
Compare also these two: stair na Stát Aontaithe “the history of the United States”, but stair Stáit Aontaithe Mheiriceá “the history of the United States of America”. In the first one, Stáit becomes Stát in genitive plural, because there it is definite by virtue of being preceded by a definite article, but in the second example, it freezes into Stáit, because it is definite by virtue of being followed by the genitive form of Meiriceá.
Meiriceá is an example of a proper name which does not take article, but as you should know, proper names often do take articles, such as the names of countries: an Fhrainc, an Ghearmáin, an Ollainn, an Rúis, an Iodáil, an Pholainn, an tSeic, an tSlóvaic, an Chróit… OF course, Éire and Alba take the article only in genitive: na hÉireann, na hAlban (and have a special dative form after simple prepositions: tá mé ag dul go hAlbain, tá cónaí ar Sheán in Éirinn). Sasana is treated the same way as Meiriceá i.e. it is otherwise the same in nominative and in genitive, but lenites in genitive: rí Shasana “the king of England”. (Note though that at least some Ulster writers use Sasain instead of Sasana, and then it has the genitive form na Sasan, similarly to na hAlban and na hÉireann).
So, basically: if a noun is followed by the genitive of a definite noun, it is itself definite and does not need a definite article. Definite nouns are those that are preceded by a definite article, and those that are definite because they are proper names (such as the mentioned Meiriceá and Sasana, as well as personal names such as Seán, Máire, Máirtín, Seoirse and so on).
When the noun that is definite by being followed by a definite genitive is put in the genitive position itself, it does not change its endings, as we saw. However, it does lenite. This way:
an fear “the man”, gluaisteán an fhir “the automobile of the man, the man’s automobile”, inneall ghluaisteán an fhir “the engine of the man’s automobile” (BUT: inneall an ghluaisteáin “the engine of the automobile”)
an chathair “the city”, forimeall na cathrach “the outskirts of the city”, muintir fhorimeall na cathrach “the people/inhabitants of the city’s outskirts” (BUT: muintir an fhorimill “the people of the outskirts”)
Sasana “England”, príomhchathair Shasana “the capital of England”, stair phríomhchathair Shasana “the history of the capital of England” (BUT: stair na príomhchathrach “the history of the capital”)