The most just way to end the war is to bring about peace and make both tribes cooperate. The most "Chaotic evil" way is to kill both chiefs and their men, i.e. to cause utter chaos at the camp. Note that, from the player's point of view, both solutions are equal. Both of them end the conflict and reward you with lots of experience.
The whole story starts right after you enter the camp, when you are approached by a girl named Jessie. She asks you to save her friend Ralphy. Use Lock picking, or the shovel on the smaller totem to save him. Ralphy himself does not matter, although he can tell you about the conflict (you can also include him in the party later on, by taking him home), but Jesse is the key character here. She is the daughter of Casey James - the Atchisonian leader. The Atchisonians have far less people and poorer equipment so, they conduct the war of attrition, by planting bombs in various spots of the camp. After you save Ralphy, you can find Jesse close to the playground. To the right of her ( the screenshot) there is a bike with a bomb planted on it (you may miss it without Perception, Angela will notice it immediately, if she is on the team) Disarm the bomb and you will save Jess.
Go to Kakkehbah's. Ask him about the war and the accident that cost him his hand. Ask him why he cannot conduct train to which he answers that even the strongest man needs both hands. Go to the Atchisonians's camp to visit their chief.
Although James does not want to wage war anymore, he is desperate to continue it, as long as he does not get the Golden Spike back. talk to him about the bombs and ask if he really wants peace. Then, mention that Jesse (almost) died in an explosion. Tell him that he should end the conflict and both tribes can use the Golden Spike to repair the railway. Then, he will agree to meet Kakkehbah. Return to the Topekan part.
During the conversation with Kakkehbah, he will ask why he should agree to peace. Tell him what he told you earlier, that even the strongest man needs two hands to conduct a train. Kakkehbah agrees to the meeting. Go to the Atchisonian gate, where you meet James and his men. Talk to James, then to Kakkehbah and present the conditions of peace. Once both of them reconcile, James cuts his hand off and Kakkehbah gives the spike back to him and both tribe will reunite
It is possible that Kekkenbah will imprison Jess and will want to use her as a bargaining card. You can convince him to free her immediately, or right after signing peace - for Casey it is a sufficient argument but, you still need to convince him that the Golden Spike needs to be driven into the railway.
1. Obtain the Golden Spike from Kakkehbah and bring it to James
The Spike is in the middle of the room with Kakkehbah, but you cannot simply approach it, because the chief's bodyguards start shooting. If you want to, you need to use the forcible solution, but it is much better to break in through one of the side entrances (you first need to deactivate the alarm at the gate, disarm a trap and finally open the gate with Lock Picking). Then, the fight is much easier and you will not be surrounded on all sides An even better solution is to steal the spike, after you turn off the lights in the room, silently. If you pull this off, without being seen, the Topekans will assume that the Atchisonians stole the Spike and you will still be able to roam freely around their camp (otherwise, Topekans attack on sight).
You can turn off the lights on the generator at the back of the building. Before you start tampering with it, disable the alarm. When you cut off the power, Kekkahbah will send someone to see what happened. Quickly, kill the man that comes - if there is nobody around, nobody will know it was you. Now, you can enter through the main entrance and sneak up to the Spike. It is going to be completely dark so, one man will have no problems getting there. Remember that the Spike ids locked up so, send out someone with Lockpicking. Then, simply exit the building and the job is done. After you disable the lights, you need to be quite quick, because the Topekans light up torches and it is going to be bright again.
Note - after all of that, Kekkahbah is not going to talk to you - he will only say that he is busy because the Atchisonians stole the spike or, if you have talked to him earlier, he will know that it was you who stole the spike, which also translates into the hostility towards the Rangers.
2. Obtain the brake shoe for Kakkehbah
It is much easier to do that, than to obtain the Spike. The shoe is hidden in the swing, in front of James's house. You only need to destroy it. If you want to play fair and learn where it is, you may intimidate James (Hard Ass 5) or tell him about the bomb and Jessie and demand that he returns the shoe - in both cases he tells you where it is hidden.
3. Kill either of the chiefs, or both - also the death of the chiefs ends the conflict. It is much easier to kill James, because you will only fight with him and Chisel. Kakkehbah is tough, because of the guards. It is best to sneak in, through the side entrance. Have several grenades prepared to kill Kakkehbah immediately - he has an automatic gun on him and, if you allow him to attack, at least once, the chances are high that someone on the party dies.