It's much easier with an opponent -- usually after the game, you can analyze it together. You will have seen similar lines during the game, can point out things the other missed, and most importantly there will be disagreements about various moves, positions, lines. Then you can analyze together and find out who is right. In complicated positions this can become lots of fun, with both sides finding lots of unexpected moves to support their argument.
As a result, you'll know more about your strengths and weaknesses, about that kind of position, and you'll have learned some positional understanding from each other.
Alone, it is a lot harder.
This is a game I played last week. I was black and just played ...Re8, attacking white's e-pawn. This is a very normal position in the King's Indian.My (much stronger) opponent played the pawn sac 8.Qc2!? Nxe4 9.Nxe4 Bxd4 here. He thinks it's good, I think it shouldn't really pose black theoretical problems.
The natural 9.Bg5 f6 10.Bh6 followed, I agree with him that that looks the most logical.
Now I tried to undermine his knight with 10...Bf5 11.Bd3 Nc6, but since ...d5 isn't going to work anyway, maybe I should have played 10...Nc6.
He played 12.Rad1, I failed to notice how irritating that is for my queen, and I decided to move it away -- but to the horrible square b6 (12...Bb6). 12...Qe7 or 12...Be5 seem better.
Now 13.c5! Bxc5 14.Qb3+ Be6 15.Qxb7 Nd5 16.Qxa8 followed, and white was an exchange up and much better.
I lost the endgame quickly, I don't know if that was necessary.
Now those things are my homework. I need to find out, by hand, whether all those things are true or not, and if what else I could have done. I need to write out a lot of lines and come to conclusions.
If I manage to find the time and focus for that, I will reap similar benefits as from a longer post mortem (we only did a short one).
Once I'm done, I'll lookup the line in a book and database, and use an engine to check my lines. But not before.
(edit: I think all my move numbers are off by one)
I am not sure how to do that. I try to notice mistakes I made and mistakes my opponent made. But I am not sure what I can do to improve my understanding of chess.
How do you analyze your games and how does it help you?