This question already has an answer here:
I think that checking your work frequently is one of the best ways to deal with this. You can also check your work with varying degrees of formality: you can carefully go back through every computation, but you can also just look back and forth between your current line of work and the previous one to check that things seem to line up. This more informal form of checking is a good one to cultivate, because it doesn’t take too much time, and can catch a lot of mistakes.
One example I use a lot: when multiplying out two expressions in parentheses, each with a lot of terms, I make sure that in the expanded expression I have the right number of terms; e.g multiplying $($two terms added together$)($three terms added together$)$ will give $($six terms added together$)$, and its pretty quick to check that you have six terms after multiplying out (quicker than computing the expansion all over again).
Related to this, another thing to try to practice is to read what you actually wrote (or what is actually written in the question), rather than what you think, or expect, to see there. (This is the basic problem with all proof-reading!) Concentration is important here, obviously, but simply being aware of the issue helps.
I think if you find that you really have trouble with concentration/alertness at a particular moment, taking a break and coming back to you work can save time in the long-term. Again, trying to cultivate a sense of what your current alertness and concentration level is can help. In general, just trying to be self-aware as you’re working is helpful, and is something that you can get better at with practice.
The only way to stop making mistakes is to stop doing math entirely (although that too may be a mistake!).
You can reduce the number of mistakes by practice, adopting good habits, and finding ways of doing things that you tend not to mess up.
An example of a good habit is any time you divide by $x$ (or any other variable expression), you immediately stop what you’re doing and split the problem into two problems: one where you add the hypothesis $x \neq 0$ (and thus can divide), and one where you add the hypothesis $x=0$ (and thus can’t divide, but can simplify)
An example of different ways of doing things is to factor rather than division. If you have an equation $5x^2 = 3x$, don’t divide $x$ out, but instead rewrite it as $5x^2 – 3x=0$ and factor the $x$ out to get $x (5x – 3) = 0$. This works out the same as the good habit above, but some people may be less likely to make a mistake if they do things this way.
But the real trick is to learn how to verify your work, and how to find mistakes after you’ve made them. This too takes lots of practice, and it takes some thought to try and figure out ways to actually do it.
Just to be clear, one of the least effective ways to verify your work is to look over each step again to see if you agree with it. If you have made a mistake, the error is still in your head, which makes you very unlikely to notice it is a mistake.
One approach I often take is to try and solve a problem in a very different fashion; if I get the same answer by two very different approaches, I’m much less likely to make a mistake. It’s important to do things differently, because if a mistake is still fresh in your head, you’re likely to repeat it if you redo things the same way.
The best answer I have is to practice so much you get bored. When in doubt, actually check yourself on something you know. Look for ways to come to the answer in more than one way, look for inconsistency. For algebra problems, plug in some numbers. What happens? If it fails for a pair of numbers then it’s not a correct algebra step. This idea stays with me to the most sophisticated math I learn, I’m always looking for multiple paths to an answer. The truth is unique, so if I get more than one answer then I know I’m missing something.
For basic problems like you mention, just take them one at a time and don’t let worrying get in the way of doing. Solve one problem. If you get it wrong, confront the mistake and make a mental effort to not repeat it. If more of my students did this then I would let them keep many more of their points.
There is a good writeup at http://www.math.vanderbilt.edu/~schectex/commerrs/ about common errors. The problem with checking work is one tends to repeat the same errors. If you can set it aside for a while and come back, that reduces the tendency, but this is not possible in a test situation. If you know a solution or a “solution” (one that you came to but is not correct) you can go step by step to see where it stops satisfying your equation. I find unit checks very useful. Even if there are no obvious units, you may be able to find some. Solving a quadratic $ax^2+bx+c=0$ you might say there are no units, but it has to be true even if $x$ is a length. Then $a$ is length$^{-2}$ and so on. Make sure all your terms match appropriately. This will catch some errors.