In simple terms, fear and greed affect investors' decision by impeding their ability to think rationally. A good investor tries to detach emotions from decision making but it is easier said than done.
Imagine you are out drinking one night with your buddies but you promise your wife to be back by 10pm. At 9:55pm, your decision will probably be governed by these two emotions.
Fear: You fly home, bcos if you don't, you have to celibate for 2 wks
Greed: You stay until 12am, and hope that your wife is asleep, next morning you wake up early and fix breakfast for her, so that you only have to celibate for 1 wk
Now let's try to see how they actually work to deter investors from making good investment decisions.
Fear: An investor has done his groundwork/due diligence, he is convinced that the stock has sound fundamentals and is relatively cheap. However, the market is in a bearish mode, he fears further downside and decides not to buy, but to wait-and-see. The market rebounds and he lost the good opportunity to buy.
Greed: The stock has done very well and all the good news has been factored in, but the investor thinks that there might be a new investment thesis for the company, e.g. they can continue to grow via M&A. On valuations, the stock is no longer cheap, unless you become super creative in calculating its future intrinsic value. Obviously, greed has taken over the investor, he fails to see that the stock is already very expensive and refuses to sell. The stock tanked after a few weeks.
Of course, fear and greed also helps in the opposite scenarios. For e.g. in the first case, the bear market might continue for 2-3 years, and by waiting, the investor could have bought the stock at an even lower price.
I guess the moral of the story is to be mindful of these emotions, understand that they will affect your decision making and try to implement ways of going around them in your investment process.
One tried and tested method would be looking at valuations, and use valuations to determine your trades i.e. only buy stocks that are cheap, in fact very much cheaper than its intrinsic value.