How has mathematics been done historically? [Book Reference Request]

Victor Katz's A History of Mathematics does a pretty good job at tracing how some of our modern notions were developed, and sometimes how these things were conceptualized at the time and place. He gets a bit technical at times, being in an awkward spot between writing a history book and writing mathematics. But overall, I think it provides some of the context you're looking for, starting with Mesopotamian mathematics.

Of course, it's difficult to say definitively that such-and-such is definitively how they were thinking in comparison to now. So often enough the best we can do is instead describe how mathematics was used and taught. Lots of mathematics in the ancient world isn't based on proof but on algorithm or learned by example, where it seems expected that you follow and can generalize. Things are often stated in physical terms and appeal to intuition, being related to constructions, farm yields, and other things that ancient civilizations understandably prioritized.

Katz also goes into later mathematics in the later chapters, at first focusing on the development of calculus, but also touching on later developments and understandings of algebra, complex analysis, geometry, and a bit of logic and arithmetic. Part four of the book, for example, has chapters called "Analysis in the Eighteenth Century", "Algebra and Number theory in the Nineteenth Century", and "Aspects of the Twentieth Century and Beyond". The book more or less tries to follow a chronological telling, but obviously this isn't completely possible with things happening concurrently.