How does people's sense of right and wrong affect their behavior? In general, people tend to simply max out their profit.

In the process to max out their profit, humans have this peculiar cognitive function, called sense of morality.

We have no idea how it evolve but it seems to have some function and affect their behaviors. Somehow.

I want to know how this strange cognitive function affect humans behavior?

For example, most of us don't just grab fried chicken and run away. We sense that it's politically incorrect and not profitable. However, some may think it's just wrong and don't do it anyway without thinking if it's profitable or not. Or do they?

It seems that people are more willing to negotiate if they think those who pressure them have earned their profit "rightfully". People are more likely to condemn if they think what others do is wrong.

But that seems to be a very amateur observation.

When we see someone put gun on someone's head, we are more likely to think, we should punish this robber rather than thinking what does he want. On the other hand, people are more willing to pay tax that goes to welfare recipients. That's probably because we think that robbing is wrong, while voting for welfare is right.

In general, how does our sense of right and wrong affect our behavior and how does that lead to our individual profit or our selfish genes?

The 2 things I have in mind is


People tend to do what's right
In conflict, people tend to side with those they think is right. For example, if a thief is beaten up to death, conservatives would side with those who protect their properties while liberals would side with the thieves.
This is an interesting question which seems that even the experts are still investigating it to a degree.

Take a look at the links I provide in this answer and look at the conformity studies like the Milgram Experiment and the works of Dr Phil Zimbardo with his Stanford Prison Experiment and his book on The Lucifer Effect (a study of the Psychology of Evil and heroism) etc.

Stanley Milgram tested earlier conformity studies by Solomon Asch to see what extent the experiment can reach.

It seems that even though there are a few who are an exception, there are those with high moral standards who can be swayed into doing something bad.  Especially when their actions are "justified" by someone in authority or seem to have more knowledge of the situation.

There seems to be a fine line which can be very blurry to a degree.  For a rather pessimistic view on society have a look at this article.