He was educated at the Edinburgh Academy, St Andrews University and at Balliol College, Oxford, where he took a first class in the final classical schools in 1868, becoming a fellow and subsequently honorary fellow of Merton College. As a journalist, poet, critic and historian, he soon made a reputation as one of the ablest and most versatile writers of the day. His first publication was a volume of metrical experiments, The Ballads and Lyrics of Old France (1872), and this was followed at intervals by other volumes of dainty verse, Ballades in Blue China (1880, enlarged edition, 1888), Ballads and Verses Vain (1884), selected by Mr Austin Dobson; Rhymes à la Mode (1884), Grass of Parnassus (1888), Ban and Arrière Ban (1894), New Collected Rhymes (1905).
He collaborated with SH Butcher in a prose translation (1879) of the Odyssey, and with E Myers and Walter Leaf in a prose version (1883) of the Iliad, both of them remarkable for accurate scholarship and excellence of style. As a Homeric scholar, of conservative views, he took a high rank. His Homer and the Epic appeared in 1893; a new prose translation of The Homeric Hymns in 1899, with essays literary and mythological, in which parallels to the Greek myths are given from the traditions of savage races; and his Homer and his Age in 1906. His purely journalistic activity was from the first of a varied description, ranging from sparkling "leaders" for the Daily News to miscellaneous articles for the Morning Post, and for many years he was literary editor of Lougman's Magazine; no critic was in more request, whether for occasional articles and introductions to new editions or as editor of dainty reprints.
To the study of Scottish history Mr Lang brought a scholarly care for detail, a piquant literary style, and a gift for disentangling complicated questions. The Mystery of Mary Stuart (1901, new and revised ed., 1904) was a consideration of the fresh light thrown on Mary's history by the Lennox manuscripts in the University library, Cambridge, strengthening her case by restating the perfidy of her accusers.
He also wrote monographs on The Portraits and Jewels of Mary Stuart (1906) and James VI and the Gowrie Mystery (1902). The somewhat unfavourable view of John Knox presented in his book John Knox and the Reformation (1905) aroused considerable controversy. He gave new information about the continental career of the Young Pretender in Pickle the Spy (1897), an account of Alastair Ruadh Macdonell, whom he identified with Pickle, a notorious Hanoverian spy. This was followed in 1898 by The Companions of Pickle, and in 1900 by a monograph on Prince Charles Edward. In 1900 he began a History of Scotland from the Roman Occupation, the fourth volume of which (1907) brought Scottish history down to 1746. The Valet's Tragedy (1903), which takes its title from an essay on the "Man with the lron Mask," collects twelve papers on historical mysteries, and A Monk of Fife (1896) is a fictitious narrative purporting to be written by a young Scot in France in 1429-1431.
Mr Lang's versatility was also shown in his valuable works on folk-lore and on primitive religion. The earliest of these works was Custom and Myth (1884); in Myth, Literature and Religion (2 vols., 1887, French trans., 1896) he explained the irrational elements of mythology as survivals from earlier savagery; in The Making of Religion (an idealization of savage animism) he maintained the existence of high spiritual ideas among savage races, and instituted comparisons between savage practices and the ooccult phenomena among civilized races; he dealt with the origins of totemism in Social Origins, printed (1903) together with JB Atkinson's Primal Law.
He was one of the founders of the study of "Psychical Research," and his other writings on anthropology include The Book of Dreams and Ghosts (1897), Magic and Religion (1901) and The Secret of the Totem (1905). He carried the humour and sub-acidity of discrimination which marked his criticism of fellow folk-lorists into the discussion of purely literary subjects in his Books and Bookmen (1886), Letters to Dead Authors (1886), Letters on Literature (1889), etc. His Blue Fairy Tale Book (1889), beautifully produced and illustrated, was followed annually at Christmas by a book of fairy tales and romances drawn from many sources. He edited The Poems and Songs of Robert Burns (1896), and was responsible for the Life and Letters (1897) of JG Lockhart, and The Life, Letters and Diaries (1890) of Sir Stafford Northcote, first earl of Iddesleigh.