Meditations begins with Descartes, with enough luxury for self-examination, coming to the conclusion that he possesses beliefs based on false assumptions. He means to extricate them. Specifically, he wants to distinguish what may be true from what is manifestly false. It would be too much to examine each belief individually, probably because each has some flaw in it. In doing so, he can rebuild a solid "superstructure" of philosophy.
While the senses can play tricks on you, particularly on things that are far from them in distance or size, there are instances where things are indisputable. He is at home, near a fire, holding a piece of paper. That can't be in doubt. He must be able to trust his senses to some degree. After all, he knows he is not in an insane asylum, right?
Or is he? How would he actually know that he isn't locked up somewhere? Taken further, how do you know you're not dreaming? He believes he is awake, sitting by the fire. Yet he acknowledges that he cannot think of a mark that separates dreams from reality. So he may be asleep after all. Apparently, he never heard of a totem.
If he is dreaming, he must also be "dreaming" what he sees, he feels, and thinks. Yet that this suggests that reality must exist somewhere. Consider an artist painting a Minotaur. He will base the monster as an amalgamation of man and bull. In other words, he creates a fantastical creature but has to base it in some elements of reality for the viewer to understand. You might then say that there are plenty of monsters that have no elements of reality, yet the artist still has to use colors you can perceive, ink that you can see. Therefore, even if we were dreaming, for us to distinguish things with our senses suggests that there is a reality. This is cogitatio.
What can we then say is true? Well certainly two and three makes five. And a square is a square is a square. These are true regardless of us being in a dream-like state. In other words, you can't dream a square that isn't a square. Therefore, there are certain things, like arithmetic, geometry, and physics, that we can be certain of.
Say God exists in the Christian tradition. He is a God that created everything, every measure, every magnitude, every instance, and is supremely good. Couldn't he also make it so that two and three make five even if that is actually false? And since carrying a foolish belief is an imperfection, then God knowingly gave us defects. Therefore, then God cannot be supremely good, for He allows this to happen.
A counter argument is that God either doesn't exist or isn't all powerful. Descartes tackles the latter very quickly: Let's say we were not created by God, but by some chance, or fate, or series of accidents. If we possess reason, then the probability of us being fooled as we grow increases proportionally with the power of the fooler. To put it another way, it takes a certain kind of power to convince you that, say, we needed to invade Iraq because they possessed weapons of mass destruction. For example, a mass media that did not question the Bush administration enough and, for whatever reasons, disseminated misinformation. It takes a completely other kind of power to convince us that the Earth is 6,000 years old when there is plenty of hard evidence to the contrary. So if man is a reasonable animal, then something powerful must be fooling us.
This puts everything up for grabs. God may not be supremely good, if he exists at all. Two and three do not make five. Squares are triangles. It's all up in the air.
So ultimately, we are left we a concept that reality should exist, but we can't trust our senses to distinguish it. That something powerful is fooling reasonable people. Call it God, or do as Descartes does and call it a demon in the head.
Yet we do have a degree of control over that demon. We can choose to consider the opposite of our own beliefs. We are reasonable enough to consider, for example, that climate change is a lie. If we wanted to, we can read the literature. No harm can come from this. In fact, this is what Descartes aims to do. His beliefs should withstand such scrutiny. And if they are found to be false, then Descartes can change his mind. And what does that mean about the demon?