In what ways did Leibniz's philosophy foresee modern mathematics? Leibniz was a noted polymath who was deeply interested in philosophy as well as mathematics, among other things. From my mathematical readings I have the impression that Leibniz's stature as a mathematician has grown in the last fifty years as some of his philosophically oriented mathematical ideas have connected with modern mathematicians and mathematics. That because of Leibniz's philosophical reflections, he foresaw aspects or parts of modern mathematics. Can anyone elaborate on these connections and recommend any references?   
EDIT, Will Jagy. Editing mostly to bump this to the front of active. It is evident that Jacques and Sergey have good, substantial answers in mind. Please do not answer unless you have read Leibniz at length. I kind of liked philosophy in high school and college, or thought I did. Recently, I read one page of Spinoza and gave up.
 A: My version, quickly, would be that he envisaged "points" that were abstractions. Whence "logical space" as came in first around 1900 (long discussion) as implied by Boolean algebra, which he also anticipated. Also "extensionality", still a scary concept for mathematics even post-Grothendieck. Sadly MO is hardly the place: the recent book by Daniel Garber on Leibniz makes the good point that his thought is a moving target, often distorted by later authors.
Edit: Since this question has survived closure, some more. If you look at the April 2004 version of the article "Sheaf (mathematics)" on Wikipedia. it says that some aspects of sheaf theory trace back to Leibniz. I put that in; no doubt it was rightly taken out. I just think it shows how far a serious discussion might lead. The codification of four "laws of thought" from Leibniz is probably an example of distortion, if hugely influential. It broke down around 1910 (Bertrand Russell round then wrote up three laws), and the extensionality implied by A = B if (and only if but that is trivial) A and B have the same attributes had to come back into mathematics by the back door, really. Parts of this question would be fruitful as new questions.
A: Practically, Leibniz preceded computer science by inventing the Stepped Reckoner, a mechanical computer which was the first to be able to compute addition, subtraction, multiplication, and division. 
More abstractly, he sought after a "calculus ratiocinator", a framework for dealing with logical statements. You can think of this as sort of a primitive formal language, although I doubt Leibniz had in mind as heavy restrictions that we use for formal grammars today.
A: To answer the title question, "In what ways did Leibniz's philosophy foresee modern mathematics?" one could mention the distinction between assignable and inassignable number that closely parallels the distinction between standard and nonstandard number in Abraham Robinson's (or Edward Nelson's) framework.  Furthermore, Leibniz's notion of a generalized relation of equality closely parallels the modern notion of shadow (or standard part).  Leibniz's law of continuity finds a close procedural proxy in the transfer principle of nonstandard analysis.  The remainder of this answer will explain how one can make such claims without falling into the trap of presentism.
Daniel Geisler speculates that "because of Leibniz's philosophical reflections, he foresaw aspects or parts of modern mathematics" and asks: "Can anyone elaborate on these connections and recommend any references?"
Several responders mentioned the connection to Robinson's theory. On the other hand, François Brunault rightly cautioned: "The statement that someone (even Leibniz) foresaw parts of modern mathematics is potentially controversial because of its subjectivity. I think most historians of mathematics now insist on the fact that the works by earlier mathematicians should also be studied from the point of view of that time, before extrapolating possible connections." 
François Brunault is correct in suggesting that there is resistance among historians of mathematics to the idea of seeing continuity between Leibniz and Robinson. Indeed, the prevalent interpretation of Leibnizian infinitesimals is a so-called syncategorematic interpretation, pursued notably by R. Arthur and many other Leibniz scholars. On this view, Leibnizian infinitesimals are merely shorthand for ordinary ("real") values, assorted with a (hidden) quantifier, viewed as a kind of a pre-Weierstrassian anticipation. These scholars rely on evidence drawn from various quotes from Leibniz where he refers to infinitesimals as "useful fictions", and explains that arguments involving infinitesimals can be paraphrased a l'ancienne using exhaustion. In this spirit, they interpret the Leibnizian "useful fictions" as LOGICAL fictions, denoting what would be described in modern terminology is a quantified formula in first-order logic. 
For example, Levey writes: 
"The syncategorematic analysis of the infinitely small is ... fashioned around the order of quantifiers so that only finite quantities figure as values for the variables. Thus, 
(3) the difference $|a-b|$ is infinitesimal 
does not assert that there is an infinitely small positive value which measures the difference between~$a$ and~$b$. Instead it reports, 
($3^*$) For every finite positive value $\varepsilon$, the difference $|a-b|$ is less than $\varepsilon$. 
Elaborating this sort of analysis carefully allows one to express the now-usual epsilon-delta style definitions, etc." 
This comment appears in the article 
Levey, S. (2008): Archimedes, Infinitesimals and the Law of Continuity: On Leibniz's Fictionalism. In Goldenbaum et al., pp.~107--134. The book is 
Goldenbaum U.; Jesseph D. (Eds.): Infinitesimal Differences: Controversies between Leibniz and his Contemporaries. Berlin-New York: Walter de Gruyter, 2008, see http://www.google.co.il/books?id=tWWuQ9PHCusC&q= 
I personally find it hard to believe Levey is talking about Leibniz, but there you have it. Whether or not Levey's analysis stems from a "Desire To Preserve The Orthodoxy of Epsilontics Against The Heresy of Infinitesimals", as Yemon likes to put it, is anybody's guess. 
What the "syncategorematic" view tends to overlook is the presence of DUAL methodologies in Leibniz: both an Archimedean one, and one involving genuine "fictional" infinitesimals. On this view, Leibnizian infinitesimals are PURE fictions (rather than logical ones). Such a reading is akin to Robinson's formalist view, and sees continuity not merely between Leibniz's and Robinson's mathematics, but also their philosophy. This view is elaborated in a text entitled "Infinitesimals, imaginaries, ideals, and fictions" by David Sherry and myself, to appear in Studia Leibnitiana, and accessible at http://arxiv.org/abs/1304.2137
HOPOS (Journal of the International Society for the History of Philosophy of Science) just published our rebuttal of syncategorematist theories that seek to sweep Leibnizian infinitesimals under a Weierstrassian rug.
A: Abraham Robinson explicitly referred to Leibniz's idea of infinitesimal quantities when developing non-standard analysis in 1960's. Wikipedia article has a quotation from his book 
Robinson, Abraham (1996). Non-standard analysis (Revised edition ed.). Princeton University Press. ISBN 0-691-04490-2. 
Added: the idea of expressing logic in an algebraic way is credited to Leibniz; see e.g. the following article in Stanford Encyclopedia of Philosophy:
http://plato.stanford.edu/entries/leibniz-logic-influence/#DisLeiMatLog
Added: Saul Kripke introduced a semantics of possible worlds (really, relational semantics)  for modal logic. 
http://en.wikipedia.org/wiki/Modal_logic#Semantics
The idea of possible worlds precedes Leibniz, but he devoted a lot of consideration to it.  Ironically, his claim that our existing world is the best out of possible ones is perhaps most known from the ridicule it received in Voltaire's "Candide". Oh wait, this is Math Overflow...
