The episode of the Vali Vadham , where Shri Rama kills Sugreeva’s brother Vali has been a topic of debate amongst many for years. Many whom have watched TV debates on this topic might have come out of it thinking Shri Rama was wrong. (especially those debates in Tamil)
A cursory view of these debates would show that mostly, better debaters would be put on the side of Vali, while hardly good speakers would be put to argue Shri Rama’s side.
It is also well known for those educated in the psychology of influence and verbal persuasion, that speakers can use techniques to argue a wrong as a right.
This can be seen in popular speakers of such topics such as Nellai Kannan ( who was recently arrested for promoting violence on Modi and Amit Shah on stage ) for whom the Dravidian ideology and propaganda they subscribe to , is reason enough to falsify what is actually written in the Ramayana.
Now before diving in, a few things.
There is this obsession among the general population, on the proper way to do battle, that one has to fight directly, facing each other, head on, yada yada. That is more romanticism than reality.
It is why some criticized Chatrapati Shivaji for his effective use of guerilla tactics even while other Kings who stuck to the traditional conventional methods were being destroyed.
Snipers are an essential part of any military today to take out high value targets, just as “encounters” have been done to take out dangerous mafia targets. Heck even a tiger hides in the bushes and ambushes its prey, so this romanticism for direct confrontation is just that.
Coming back to the Ramayana, before getting into any specific incident within the Ramayana, we have to see what the overarching theme of the text is, and it is very clear in the introduction itself.
Valmiki asks Devarishi Narada among other things, who in the world possesses all the (good) qualities, who knows about dharma and what has to be done , who has control over himself and has conquered anger, who is devoid of jealousy , is truthful in his words and firm in his vows etc etc.
It is from this that the entire Valmiki Ramayana starts with Devarishi Narada saying, that one who possesses all such qualities is rare, and after describing the physical qualities of such a person, he also mentions that such a person exists in the Ikshvaku clan,
known as Rama and that he, is one who knows about dharma, firm in adhering to the truth and devoted to the welfare of his subjects, knows the truth about the Vedas and all sacred texts and is the protector of dharma etc etc.
So , the entire epic is about such a personality, who knows dharma , is devoted to dharma , has mastered all the holy texts including the Shrutis and Smritis and has conquered all negative traits like jealousy and anger.
Hence if anywhere in the text, there is confusion if Rama is following dharma and what is prescribed in the sashtras , or if he has succumbed to baser traits like jealousy or anger, it would simply be an error in understanding.
Now in the Vali Vadham , Shri Rama had promised Sugreeva that he would kill Vali , so Sugreeva called out Vali for a fight. And Tara, Vali’s wife had warned Vali that this was a ploy and not to go, to make peace with Sugreeva, and that she had heard that Rama of Ikshvaku clan was now supporting him.
Vali actually knew of Rama and the Ikshvaku clan and had chided Tara saying that Rama was someone who knew what Dharma was and would not resort to Adharma. Hence when he was shot (in the chest) while battling Sugreeva, and saw that it was Rama , he was angered and questions Rama on his adherence to Dharma.
( Here I quote his questions from Valmiki and Kamba Ramayana)

