He was born in Glasgow on 31 December 1867. He was the eldest of seven children of Elizabeth McDowall of Alloa, and Thomas Hannay (1841–1916). His father owned the estate of Rusco, but in 1878 had sold it to settle debts, theafter becoming an agent for the iron-masters William Whitwell & Co. The family thereafter lived at 16 Woodside Terrace in Glasgow. He was educated at the Albany Academy in Glasgow. He then went first to the University of Glasgow and the University of Oxford graduating with an MA from the latter in 1891.
He began lecturing in Ancient History at the University of Dundee in 1894. In 1901 he transferred to the University of St Andrews. From 1911 to 1919 he left academia to act as Curator of Register House in Edinburgh. From 1919 to 1930 he was Professor of Scottish History and Palaeography the University of Edinburgh. From 1930 he was Historiographer Royal for Scotland.
In 1922 he was elected a Fellow of the Royal Society of Edinburgh. His proposers were Cargill Gilston Knott, James Hartley Ashworth, James Alfred Ewing, and Sir Edmund Taylor Whittaker. The University of St Andrews awarded him an honorary doctorate (LLD) in 1923.
In 1899 he married Jane Ewing Wilson CBE (died 1938), daughter of Rev John Stewart Wilson DD of New Abbet. They had one son, Robert Stewart Erskine Hannay (born 1900).
He is the grandfather of writer Robert Alastair Hannay.
- The Arch-Bishops of St Andrews (co-written with Sir John Herkless) (1907)
- St Cuthbert's Kirk and its Saint (1933)
- The Letters of James IV (1953)
- The Letters of James V (1954)
- Robert Kerr Hannay: School of History, Classics and Archaeology, Univ. of Edinburg, retrieved 17 March 2011.
- Robert Kerr Hannay: amazon.com, retrieved 17 March 2011.
- "RootsWeb.com Home Page". freepages.genealogy.rootsweb.ancestry.com. Retrieved 10 February 2018.
- Glasgow Post Office Directory 1879–80
- Biographical Index of Former Fellows of the Royal Society of Edinburgh 1783 – 2002 (PDF). The Royal Society of Edinburgh. July 2006. ISBN 0-902-198-84-X.
- "Fellows of the Society at October 26, 1936". Proceedings of the Royal Society of Edinburgh. 56: 329–355. 1937. doi:10.1017/s0370164600015364. ISSN 0370-1646.