What makes us to perform bad deeds and how to overcome the tendency to do do wrong things? I try to pray all the namaz, sometimes tahajjud also, I never think or do bad for others, still most of my prayers remain unanswered. Also the sadness and failures drag me towards sins.

1- Your prayers are answered most of the time, but you are not aware of it. Sometimes the timing is not right, so Allah answered your prayer but He will deliver it to you at the appropriate time. Or sometimes Allah knows what you asked for is not good for you, so He replaces it with something better.

2- Avoid sins by always imagining the Prophet (s) and the Imams (a) are sitting next to you. Draw a red line around those sins that you regularly commit (just like we draw a res line around some sins like drinking and hence we don’t even think about it). Train yourself to believe that every sin is a big deal