History of the language
Gàidhlig is the Scottish Gaelic name for Scottish Gaelic. It is related most closely to the other two Gaelics, or Q-Celtic languages, Irish and Manx, and more distantly to the P-Celtic languages, Welsh, Cornish and Breton. It split from Old Irish in about 500AD if you want to insist on using the tree model of language change, but really there was a dialect continuum between Scottish Gaelic and Irish until sometime in the Middle Ages.
In the eleventh century Gaelic had reached its high point in Scotland, and was the language of the royal court, the nobility, and the church, known across almost all of the country. Late in that century, the court became anglicized, and Norman French and English became its official languages, but the Lordship of the Isles which emerged in the mid-twelfth century maintained the Gaelic language until its destruction in the late fifteenth century.
From the twelfth until the eighteenth centuries, the educated classes in Ireland and Scotland possessed a common form of Gaelic known as Classical Gaelic, which was a codified and formal register in which a great deal of literature, particularly religious poems and bardic praise poetry, was written.
In the eighteenth and nineteenth centuries, following the Act of Union with England and Wales in 1707, Gaelic was discouraged in favour of English; ecclesiastical schools used it until the Education Act of 1872, which had no mention whatsoever of Gaelic. Compulsory education in English was disastrous for the state of the language, and no place was given to the language until 1918, when schools in those areas which remained Gaelic-speaking were obliged to provide Gaelic lessons.
Nowadays Gaelic as a community language is mainly confined to the Western Isles, particularly Lewis and Skye, where it has been maintained in part due to its use in church in these strongly religious communities. The BBC broadcasts radio and television programmes in Gaelic to the whole of Scotland, and the language is a school subject throughout the country (I believe).