I can't help you with the Freemasons and Illuminati, but for the Templars there are a ton of academic books. I would start with the works of Malcolm Barber and Helen Nicholson:
Malcolm Barber, The New Knighthood: A History of the Order of the Temple (Cambridge University Press, 1994)
Malcolm Barber, The Trial of the Templars (Cambridge University Press, 2006)
Helen J. Nicholson, The Everyday Life of the Templars: The Knights Templar at Home (Fonthill, 2017)
There are lots of others about various aspects of the Templar order, in various countries...it depends on what you're looking for, really. But Barber and Nicholson are good for a general overview.
I've tried to rank these books based on how good they'd be as an introduction to the topic
Freemasonry: A Very Short Introduction by Andreas Önnerfors is exactly what it sounds like. It's a quick overview and easy to read, but without a lot of detail.
The Handbook of Freemasonry edited by Henrik Bogdan and Jan A.M. Snoek has a whole chapter on Freemasonry and the Knights Templar. The chapters are on different subjects (politics, religion, historical developments, rituals and organisation, culture etc) and can be read independently, if you're only interested in some of them.
The Order and the Archive: Freemasonic Archival Culture in Eighteenth-Century Europe is a dissertation by Tim Berndtsson. It revolves around the Order of the Strict Observance and the Swedish Order of Freemasons, two 18th century Masonic orders from Germany and Sweden that claimed to be the successors of the Knights Templar. The Illuminati is also discussed, but to a lesser extent.
The Secret School of Wisdom: The Authentic Rituals and Doctrines of the Illuminati has a good introduction chapter that explains the history of the Illuminati, and the rest of the book is an English translation of original documents produced by the Illuminati for internal use.
Jesuits, Freemasons, Illuminati, and Jacobins: Conspiracy Theories, Secret Societies, and Politics in Late Eighteenth-Century Germany is a dissertation by Steven Luckert. It's about the conspiracy theories spread by the Illuminati (among others) about a supposed Jesuit infiltration of the Strict Observance (and other groups), and the conspiracy theories about the Illuminati that started appearing shortly after that.
Initiating Women in Freemasonry: The Adoption Rite by Jan A. M. Snoek is also very interesting. The adoption rite was a separate series of rituals used in the 18th century by adoption lodges, which were attached to male Masonic lodges and initiated the wives, daughters or sisters of the members of the lodge.
British Freemasonry, 1717-1813 is a series of five volumes edited by Jan A. M. Snoek. It's a fantastic collection of source texts, but it's not exactly easy to read.
Michael Haag The Templars - History & Myth available on Amazon. It discusses the actual historical information we have on the order (in rather good detail) and also spends about a third of the book on the origin of the conspiracies linking the Templars to Freemasons and Illuminati.
His book The Tragedy of the Templars is also worth a read.
For the freemasons, the historian Margaret C. Jacob has a number of academic books on their history and connection to other Enlightenment movements, like The Radical Enlightenment: Pantheists, Freemasons and Republicans, see the review in Eighteenth-Century Studies here (you can sign up for a free jstor membership to read the full review). She also wrote a book specifically about freemasonry titled The Origins of Freemasonry: Facts and Fictions. There's an interview with her here where she summarizes the basic history.
The Cambridge Handbook of Western Mysticism and Esotericism also has sections on the history of Freemasonry and Rosicrucianism. Another academic book I found interesting was Occult Features of Anarchism (reviewed in the LSE Review of Books blog here) which talks about the intertwined history of secret societies like Freemasonry with more political revolutionary organizations (this book also talks a bit about Adam Weishaupt and the real Illuminati).