This is a very good question! There are actually 3 different types of ear pins: 1) fear, 2) dominance/annoyance/anger, 3) concentration. It can be hard to distinguish which one it is sometimes, but that's where looking at the rest of the horse's body language comes into play. Lets take each type of ear pin at a time.
For the fearful ear pin, this is actually the easiest to spot because the horse, at this point, is exhibiting other signs of fear: high head, whites of the eyes showing, overall very tense, and sometimes the horse will charge if he has no other option. Granted this is an extreme situation, however I have personally seen a scenario like this, and it's not pretty.
For the dominant, annoyed, angry ear pinning, this is seen when the horse is being forced to do something he doesn't want to do (even if someone is a NH student...they might be using good techniques, but they have forgotten about how the horse sees things and has failed to use proper motivational strategies to get the horse to WANT to do something). You can also see this when the horse is being nagged at, he's just annoyed. Some horses, like my warmblood, will pin his ears out of dominance if he doesn't see and feel my leadership.....this is a very subtle thing but one that is actually very common. Once I bring my leadership level up and prove to him that I am worth listening to, and that following me feels good and doesn't involve him feeling like a loser, then his attitude becomes positive and he offers me more. Snaking of the head is a big dominance sign, a lot of stallions do that. Signs that go along with this kind of ear pin can include: swishing the tail, head flinging/snaking, charging, kicking out, pulling on you while on the circle, looking at you dead in the face and pinning the ears flat back, nose crinkled, grinding the teeth/chomping on the bit, slow, calculated pawing, etc.
A good example of a horse pinning their ears in concentration are really good cow working horses. They are so darn focused on that cow, you can feel their concentration. Their overall body is tense, but it's a positive tension, if you will. When a horse has to be athletic, the muscles will be tense, ready for action, but it's not a negative tension. Negative tension is when the horse basically says "No" and fights you. A brace in the body started as a brace in the mind, and it's the rider's job to dissolve that brace in the horse's mind. Cutting horses pin their ears in concentration. In Parelli, we play a version of cutting, you might have seen it on a video. When I play it with my warmblood, he will pin his ears, not flat back though, but here's the thing. He does it, 1) out of concentration, and 2) because he is an innately dominant horse and the more intense things get, the more he feels the Drive instinct come up in him. I know it's concentration because when I stop, his ears perk back up to full forward and he's looking at me like "What next? What next?!" His play drive comes up A LOT. If he was angry or annoyed with me, he would continue to have a sour look on his face even after I stopped. Does this help any?