Replied to the wrong post, so I will repeat it here.
The reason why airlines sometimes are so anal about scrutinizing passport or visa status of international passengers is that they have to pay enormous fines if a passenger in question is refused entry into a destination country due not having a proper passport or visa. It is an airline's job to check if a passenger has these in order and if the airline fails to do this then they will be fined at least $15000 and probably even more. The airline licence to fly to international destinations usually comes with such conditions.
Visa rules are complex and constantly changing so they may refuse boarding in complicated cases where a passenger appears to be violating some rules. In most cases it is indeed the fault of a passenger. For example, when visiting the US under visa waiver program one has to have a return ticking within allocated time. Also a visa waiver cannot be used when flying to the US in transit and then taking ground transportation to ultimate destination in Canada. Many passengers forget about this and then they blame the airline when they are not allowed to board the plane.
But in some cases it is clearly the fault of airlines who is not aware of some rare exception or recent changes in immigration rules. Nobody's perfect. In such case I would recommend a passenger to study the entrance rules and be ready to explain them to airline's representative and refer to authoritative sources. I have heard cases when people have successfully received reimbursement from the airline for their inconveniences including additional hotel bills etc. because they were unjustly refused boarding.