Writing is unlike many other activities, in that thinking about writing is actually (almost) writing itself. I often write things out in my head when I am not in front of the computer or a notebook. By doing so, I usually have phrases in mind when I sit down to write. We call writing the actual putting down the words in some written form, analogue or digital, but we also call writing the composition itself, independent of its physical manifestation.
Almost writing. Obviously if you do a lot of writing in your head and never put anything down in written form, you will forget a lot: eventually almost everything. That is why mental writing is incomplete. Yet it is hard to imagine not forming sentences in your mind as you are working on the project--reading something else about your topic, for example. With book reviews, for example, I find that I start to write the review in my head the minute I start reading.
I find it useful to do a lot of purely mental work at the beginning of a project. Imagining the book already complete and the relation of each part to every other part. This almost has to be done mentally because not much is written down yet!
You also have to develop advanced memory skills to be able to hold a lot of complex information in the mind at once. Not memory of details, so much, as of the bigger picture.