It just takes practice of doing code yourself. For instance when you start off programming there are many errors you are going to make such as (put = instead of == [in C++] and so on and so fourth)
So when you read other people's code you are most likely to spot out that problem in the code rather than a problem that didn't occur with you. It's just how we humans are. If our eye catches something we recognize we tend to focus on that. So the answer is just to keep programming and it'll become easier.
Some tricks you probably can use are these (but it still might be harder to spot the problem)
1.Most times people make a simple mistake but it affects the way the program runs.
ex : num1 + num2 = result ..... It should be the other way around result = num1 + num2;
if a coder put something like that it would leave an error.
Another example could be in an if statement (C++)
if (num1 = num2) ... the right answer should be if (num1 == num2) [Note: 2 = signs]
If you put something like that it would cause an error to your code execution.
2. A variable name could be wrong or put in the wrong spot.
3. Sometimes a command can be written incorrectly (most common with beginners).
4. A code that has an infinite loop
Ex: for (int i = 1 ; i >= 0; i++)
5. One piece of code could be missing.
6. There's lots more. I can't really explain how I analize it, It's just when there's an error it catches my eye because most of the errors I see I've made that mistake before and therefore I'm used to seeing that mistake.
Hope this helped you a bit :D