First of all watch the horse as it is standing still. If it is lame, and obviously resting and avoids placing weight on one leg, that will probably be the injured leg.
Watch the horse as it is ridden on a loose rein, or trotted in hand in a straight line on a loose lead rope over firm, level ground. If the horse is lame on a front leg, the horse will dip its nose down. If the horse pops its head up slightly, the lameness is in the hindquarters or legs. If a horse is obviously lame on both front or rear legs, there will be no head bob. Their strides will be choppy and short.
When the horse is lame in the front you can determine which leg is lame by watching carefully and noticing when his head is up, and which leg has hit the ground at that moment. He will dip his head down as the sound leg hits the ground. If the lameness is in the rear, he'll drop his hip slightly on the side that is lame.