Brief story of the Philosophical Investigations
Von Wright gives a reconstruction of the history of the publication of Philosophical Investigations, as it developed from Wittgenstein's papers. Wittgenstein's method of assembling his work is well known. He often comes back on something already written, changes it, cuts it and paste it somewhere else in another arrangement. He is one of the first forerunner of contemporary habit of "cut and paste", so easy with a PC and so difficult with scissors or typewrite machine. Actually many of the remarks we find in the Philosophical Investigation can be found in Typescripts and manuscripts from the thirties. In the published preface, written in 1945, he speaks of a "precipitate of philosophical investigations which have occupied me for the last sixteen years", which means since 1929, the year of the great economic crisis, and of Wittgenstein's coming back to philosophy. This means a continuous effort of rearranging his material. We have an enormous amount of papers which is now available thanks to the Bergen Archives.
It is not easy to have a clear grasp of all the work Wittgenstein has done. However a hint about his attempt to write a book is given in the so-called "Big Typescript", dictated in 1933, where we have a real (!) book, with chapters and sections, with titles for each chapter. There are 140 chapters divided into 20 sections, and each chapters has many remarks (around 20 each, but they vary much from chapter to chapter). Well. It was a book, and we find many remarks we find in the Investigations, like remarks on Moses, agostitian language, family resemblance, and so on. But these remarks are in different order and in different context than when they appear (slightly changed) in the latest book. Wittgenstein was not satisfied with this effort and he continued to rearrange his remarks. In 1934 and 1935 he dictates the Brown Book and eventually in Norway, in 1936, he gives a first revision of remarks (corresponding more or less to sections 1-188 of the Investigations. It is Typescript n. 220. He worked again on this typescript in 1937-1938 and even made an attempt to contact a publisher (Cambridge University Press), and made a preface (1938: not so different from the one published now). He had at the time much in philosophy of language and in philosophy of mathematics (and even the earlier Big Typescript has a big part dealing with the notion of sense and proposition and another big part dealing with philosophy of mathematics
In 1938 there is the Nazi invasion of Vienna and in 1939 Wittgenstein, after a year full of movement in different towns, becomes appointed Profeffor of Philosophy, and teaches philosophy of mathematics to graduate students in Cambridge (among his pupils Alan Turing is a critical antagonist). He works hard in the philosophy of mathematics, arriving at a radical rejection of intuitionism which was one of his favorite point of view since his encounter with Brouwer. However he begins to serve as a medical orderly during the war and held the chair of Porf. only from 1945 to 1947. In 1945 he has another version of the book, and he writes the preface. However he begins to expand and change again until a big selection called Bemerkungen I, made of 698 remarks, from which he kept something like 400 remarks, while other became what has been later called "Zettel."
In 1947, after his retirement from Cambridge, he settles for a while in Ireland, where he works again to his book. Howevere his thought begins new direction, and even a new style. The second part of the Investigations comes from things written after 1945. In 1948, he said to the editors visiting him in Dublin, that he probably would have changed (or deleted) some of the last section of what it is now the first part (the names "part I" and "part II" have been given by the editors).
Much of the remarks on the philosophy of mathematics have been kept out of the published book; and the idea was probably to collect his remars (the last sentences of the second part of the Investigations indicate the intention to give some remarsk on the foundation of mathemtics, analogous to the ones about psycology. Most of his last remarks have been on the philosophy of psychology, and some of the latest are on epistemology ("On Certainty"). You may find many resources about Wittgenstein's published and unpublished work. Just give a look to the list of published work. Still the Philosophical Investigations Is what he has left of nearer to "the" book he wanted to write. It is worth reading it, as it is.