I will attempt to answer this, but my answer is going to be controversial. Please keep in mind that it is not my intention to offend anyone.
Alright, let's start with some ground rules. For the length of this answer, consider that Krishna is not Lord Krishna, the god and that the Mahabharat is not a religious text revered by millions. Instead, let us analyze the Mahabharat as if it is a (ridiculously good) fantasy story, and Krishna is a central character in this story.
Introduction and back-story
Krishna is introduced to us early on, as a cousin of the Pandavas. He is accomplished, wise, and powerful in his own right (unlike Pandavas or Kauravas at this point, who are squabbling children). This is because he has overthrown Kamsa, the King of Surasena kingdom, native land of the Yadavas. However, he has multiple problems of his own. Firstly, he is a cowherd, not royalty. The Yadavas rule by council, not by king. Thus, even though Krishna is the leader of the Yadavas, he is not equal to royalty. Further, Kamsa was Jarasandh's Senapati. Jarasandh is the emperor of India. Every other dynasty, including the Kurus, pays obeisance to him. This doesn't leave Krishna with very many allies. That Krishna is capable and a political genius (at such a young age) is evident because Jarasandh has been unable to crush him outright. But Krishna has now fought 18 wars with Jarasandh, and has slowly lost territory to him. He has been forced to leave his land and move to the island of Dwarka. He needs help.
Guess who else need help? The Pandavas. They are staking a claim to the throne of Hastinapur on extremely untenable grounds: It is an open secret that Pandu was impotent. Who then, are these children, arrived from nowhere? Here is Krishna's opportunity. The Pandavas will oppose Duryodhana, who is Dhritarashtra's son. Dhritarashtra is politically aligned with Jarasandh. Thus, Pandavas are going against Jarasandh himself. Krishna aligns himself with the Pandavas.
Jarasandh vadh and the Rajsuya yagna
I'll skip some details here, because I don't intend to reproduce the Mahabharat entirely. Suffice to say that Krishna and Arjuna are the closest of friends now. Krishna has helped Arjuna earn multiple celestial weapons, he has convinced Drupad to let Draupadi marry the Pandavas, he has orchestrated the building of the Mayasabha in Indraprastha.
The Rajsuya yagna is his chance to strike against Jarasandh. He convinces Yudhisthir that he needs to perform the yagna to establish his supremacy over India. Who stands in Yudhishthir's way? The current emperor of India, Jarasandh. So do they declare war on Magadh? No. Krishna, Arjuna and Bhima sneak into Magadh, and challenge Jarasandh to single combat. Bhima kills Jarasandh, after which Krishna installs Jarasandh's son Sahadev onto the throne of Magadh. Thus, he eliminates his biggest enemy, gains access to a sizeable army, and makes multiple allies when he frees the political prisoners of Jarasandh. Who else stands in his way? Shishupal, king of Chedi, his lifelong enemy, and the Senapati of Jarasandh's army. Yudhishthir invites Shishupal to the Rajsuya yagna. Krishna is the guest of honor for this yagna, over and above celebrated people like Bhisma and Drona. Krishna lets Shishupal berate and belittle him for a long time–long enough to convince everyone that Shishupal is an asshole of the first degree. Then he calmly beheads him. No battle, no challenge to fight to the death, nothing. In a single stroke, in front of enough witnesses to assert that Shishupal truly deserved it, the Senapati of Jarasandh is gone.
Who else is Krishna's enemy? Duryodhan, friend of Jarasandh, and a political genius in his own right. Duryodhan has befriended Balaram, Krishna's elder brother and the most important person on the Yadava council after Krishna himself. Krishna did not foresee this, but Balaram teaches the mace to Bhima and Duryodhana, and he is impressed with Duryodhana. Duryodhan will not be so easy to eliminate. We will deal with him later.
Subhadhra and Samba
Balaram promises Subhadhra to Duryodhana in marriage. If this comes to pass, the two families will be much too closely linked for Krishna's liking. Lucky then, that Arjuna is there to whisk her away.
However, this is one instance where Krishna's intentions do not come to pass. Krishna's own son, Samba, is fool enough to fall in love with Duryodhana's daughter Laxamani. He tries to whisk her away just like Arjuna did with Subhadhra. However, he is no Arjuna, and Duryodhana is no fool. He is caught and put behind bars. Duryodhana announces that Samba will be put to death. Even in this situation, Krishna cannot come to negotiate with Duryodhan. This is a political loss, he stands to lose face. Instead he pleads with Balaram to go on his behalf. Balaram successfully negotiates with Duryodhana, promising him support in battle, and brings Samba and Laxamani back to Dwarka. The families are intertwined. Krishna will face a much tougher task getting support from the Yadavas against Duryodhana now.
Preparations for the Kurukshetra war
Krishna does not have an option. He is over-ruled by his council, and pledges his army to Duryodhana. However he says that he will fight on behalf of the Pandavas, because they have asked him for help too. He makes it sound as innocuous as possible: "I will only be a charioteer. I will not take up arms. I only wish to accompany my friend Arjuna. What can little old me do?" And now Duryodhana makes a fatal mistake. He underestimates Krishna. He agrees to Krishna's conditions.
Krishna plays his master-stroke early on. He is fully aware of the capabilities of his army. If Balaram enters the battlefield on Duryodhana's side, it is game over for the Pandavas. So Krishna convinces Balaram that this war will be full of adharma (he is not wrong on that count). A man of Balaram's accomplishments should not taint his soul by participating in such a war. He should instead go on a pilgrimage to the holy sites in India. This is Krishna's greatest political maneuver in the Mahabharat. With Balaram gone, Kritivarma becomes the Senapati of the Yadava army. It is a testament to the quality of Yadava soldiers that Kritivarma and Satyaki (who is the only Yadava to fight for the Pandavas) are two of the 10 people to survive the war.
When Krishna goes to Hastinapur to sue for peace, one last time, he plays another closely guarded card. He takes Karna aside and tells him of his parentage. He then tries to sway Karna by promises of power and rule. He even offers Draupadi as a final perquisite. Karna turns him down. Luckily for Krishna, Bhishma too has his own agenda. He knows the truth of Karna's birth, and does not wish for him to fight his brothers. So he insults Karna in the war council, and tells him he is only fit to fight ardha-rathis. Karna swears not to enter the battlefield until Bhishma falls. Thus the Pandavas are free of the terror of Karna for 10 days. When Karna will finally enter the battlefield on the 11th day, Krishna will try again. He will send Kunti to Karna, to convince Karna to switch, and when that fails, to beg for the lives of her sons. Thus, Krishna will ensure that 4 sons of Kunti are safe from the wrath of Karna.
Machinations in the War
There are many, many things that Krishna does on the battlefield, but most people are already aware of them. Quickly then, the highlights:
- Convince Arjuna to fight.
- Convince the Pandavas that Bhishma is slaughtering their armies and needs to fall
- Protect Arjuna from himself (the Abhimanyu/Jayadrath incident)
- Formulate and execute the plan to slay Drona (naro va kunjaro va)
- Tell the Pandavas how to counter Ashwatthama's multiple celestial weapons
- Stop the Pandavas from infighting on multiple occasions
- When Dhrishtadyumna chops off Drona's head, Arjuna sees red.
- When Karna defeats and humiliates Yudhisthir, Yudhisthir runs back to his tent. He blames Arjuna of incompetence in killing Karna with such vigor, that Arjuna pulls out Gandiva to kill Yudhishthir himself. Krishna cools things down.
- Use Ghatotkach as a pawn to rid Karna of his celestial Shakti.
- When Ghatotkach dies, the Pandava camp is in mourning. Not Krishna though. He dances in joy, claiming that "finally, Karna is surmountable"
- Convince Arjuna to kill Karna when he is unarmed and on foot
- Gesture Bhima to hit Duryodhana in the thigh, blatantly against the rules of mace battle.
- Stop Balaram from slaughtering Bhima on the spot for cheating.
- Balaram is back from his pilgrimage in time to watch the battle between Duryodhana and Bhima. Krishna has to hold him in a bear hug when Bhima breaks Duryodhana's thigh.
In summary, the Pandavas are bumbling fools who do not stand a snowball's chance in hell without Krishna to guide them on every step. In return, they revere Krishna, and proclaim that he is their god, their spiritual leader. Krishna enters the fray to be royalty, ends up becoming a God.