I've been on both ends of this, usually the lower end, and I can say first hand it is hard to not take getting paid less as a personal affront to your dignity. And every time I was underpaid I not only didn't get a big raise, but I took much longer than expected to find another job. If you are underpaid, your best option is to leave in most cases. Don't underestimate how long you have to tolerate the low pay while you try to leave.
Everything you say is true though, it can cause a lot of drama if people start having hard feeling over pay. This is why companies sometimes tell people not to share their salary, or even put it in the company handbook, etc, and I'll say again: it is illegal for a company to tell or even suggest that you not to share you salary.
> And every time I was underpaid I not only didn't get a big raise, but I took much longer than expected to find another job.
How are the two related? Why does being paid less cause you to take longer to find a new job?
Being paid less didn't actually make me take longer to find another job. But I looked for other jobs to get more money. My point is, simply knowing you are paid less/unfairly is not a silver bullet. Most companies will refuse to give raises on demand, on principle. You most likely can't just get a new job right off either or you would have just done it. So you'll be stuck for months or even years knowing how much less you make than your coworkers. Nobody thinks they'll mind knowing the truth, because they underestimate their own ego and how difficult it is to get more money.
Most businesses would rather pay someone new and unproven significantly more than you're asking rather than give you, say, a random 10% raise. It kinda makes sense, because there's no limit to what you can ask for. Most non-tech people seem to resent how much more we make as well. So for various reasons, they don't want to pay you more and/or don't believe you are worth more, and you have to prove it to them by leaving.
I am 99% convinced that pay secrecy primarily benefits employers and management at the expense of most employees. It creates an asymmetric information environment that makes it difficult for employees to negotiate raises or even to be paid market wages.
The 1% uncertainty is that government jobs (which have pay transparency) tend to be underpaid, and the rare (?) private workplaces with pay transparency don't seem to have done much better than their pay-secret counterparts, with the exception of law firms, where the associate/partner model seems to have caught on. Union negotiated rates seem to have up and down sides.
Of course, you should really consider how much money the company is making, where it is coming from, and how it is being spent. In my experience, (non-founder) technical staff members are often paid very poorly compared to the money that they bring into the company, even after considering large amounts of overhead, expenses, benefits, taxes, etc.
You would think that, but imagine you are making less than someone who does less work than you, or is clearly less skilled. Although you might initially blame the company, you may grow to resent your coworker who is getting more for less. Especially if it's a lot more. You can't really start making more demands of them because they make more, or else slack off because you make less.
I think there are situations where secrecy can be good and others where it can be bad. When salaries are public and negotiated by groups, that can lead to other worst-case scenarios. Your company can always decline to pay you more by coming up with a delusionally low pay scale, while claiming the high ground of fairness or some shit. When people can negotiate for more, they can potentially raise the bar gradually. And with the legal protection behind salary disclosure, and websites that make it easy to share your salary, I think it's better to let salaries fluctuate with the market. It might be nigh impossible to demand a raise without switching jobs, but at least the current norm lets employers effectively bid on you.
Now suppose after 5 years you found out that coworkers were being paid twice your salary for the same work, and had been for years.
It seems to me that you want to find this out sooner rather than later.
At one job where I was perhaps making 70% of what my coworkers did, and I found out a couple of years before I was able to leave. It did upset me a lot. I knew I was underpaid before that because of how other companies paid, but knowing specifics definitely rubbed salt in the wound. I suppose knowing specifics might be a necessary evil but I think back then it might have been better to not know. On the other hand, that experience set me down a path that eventually worked out ok, so I can't really say I wish I didn't know.