The short answer, in the order the sources rank it
Odin is attested as a god of war and of the dead, of poetry, of magic and runes, of wisdom, and of kingship. None of those is a modern add-on. Snorri Sturluson's Ynglinga saga, the euhemerized opening of his Heimskringla, lists most of them across a handful of chapters (chapter numbers here follow Laing's English translation). What the surviving Old Norse texts never do is hand him one tidy title. The sections below are stitched together from very different documents: battle-minded poems, a thirteenth-century Icelandic handbook for poets, a Roman ethnography, and a German churchman's report on a Swedish temple. Each one recorded the side of Odin that mattered to its own audience. I lean hardest on Snorri, who is the easiest to cite and the least neutral: he wrote in Christian Iceland two centuries after the conversion, so his Odin tells us what educated Icelanders remembered, not what worshippers did.
The sections below take the jobs one at a time, with the source each one rests on. If you only need a sentence, war and death are the best-attested, poetry is the most distinctive, and 'god of war' alone is the answer that loses the most.
One name, five jobs
The name itself is the best explanation for the pile-up. Old Norse Óðinn comes from a reconstructed Proto-Germanic Wōðanaz, usually translated 'lord of frenzy' or 'leader of the possessed', built on the adjective wōðaz, 'possessed, inspired, raging'. The related Old Norse noun óðr means both 'furious' and 'song, poetry', which is how battle-rage and verse ended up under one roof. Around 1075 to 1080 the chronicler Adam of Bremen put the idea in a single Latin line, Wodan, id est furor, 'Odin, that is, frenzy'.
The reconstruction is a scholars' inference, not a document, but it fits the texts. The god who sends warriors into a mad fury also hands out verse, and he is the one who reads fate in a trance. More than 170 names are recorded for him, more than for any other Germanic god.
War, and the catch in it
The war side is real. Ynglinga saga, chapter 2, says Odin won every battle he fought and that his people believed victory belonged to him; before sending men out he laid his hands on their heads and gave them a blessing. Chapter 6 is more specific: he could make enemies in battle blind, deaf, or terror-struck, and their weapons so blunt they cut no better than a willow twig, while his own men went without armour, 'as mad as dogs or wolves', biting their shields. Those were the berserkers. Around 1075 Adam of Bremen described the Uppsala temple image of Odin as one who 'rules war' and gives people strength against the enemy, armed as 'our people depict Mars'. Adam wrote from secondhand reports and never saw the temple, and scholars question how much of his account is fact (see the guide to Norse religion), so treat it as one outsider's impression.
The central throne in that temple belongs to Thor, whom Adam calls the mightiest, with Odin and Freyr on either side. That makes Odin's war role a matter of command over outcomes. Adam does not present him as the biggest fighter or the god most people prayed to.
And the outcomes are not fair. In the prose introduction to Sigrdrífumál, Odin had promised victory to a king named Hjalmgunnar, but the valkyrie Sigrdrífa brought Hjalmgunnar down in battle. Odin pricked her with a sleeping thorn, told her she would never again win in battle, and condemned her to marriage. Ynglinga saga, chapter 10, states the same principle from the human side: the Swedes believed Odin often showed himself before a great battle, and 'to some he gave victory; others he invited to himself', and they counted both as well off. This war god decides who wins and who dies, and merit has little to do with it.
Another figure has a claim to the plain title 'war god'. Roman writers equated the continental form of Týr with Mars, and a third-century inscription names a 'Mars Thincsus', Mars of the assembly. Some scholars propose that Týr once held a much more central place and that Odin rose over him in prehistory. The claim is a proposal and remains unproven, but it is a reason to check who else applied before handing Odin the war-god title.
Death: the hall of the slain, and a wolf at the end
Odin's link to the dead is the other half of the war role. Valhalla, Old Norse Valhǫll, means 'hall of the slain'. In Snorri's Prose Edda, Odin fills it with the einherjar, warriors who fell in battle and became his adopted sons, and he sends valkyries to every battle to choose who is to die. In Ynglinga saga, chapter 8, Odin's law is that the dead be burned with their goods, so that each arrives in Valhalla with the wealth that went on the pyre. Chapter 7 adds a stranger detail: he sometimes called the dead out of the earth or sat beside burial mounds, which earned him the titles 'ghost-sovereign' and 'lord of the mounds'.
In Völuspá, the seeress foretells that at Ragnarök Odin fights the wolf Fenrir and is consumed, and that his son Víðarr avenges him by stabbing the wolf in the heart. Two carved stones, Thorwald's Cross on the Isle of Man and the Ledberg stone in Sweden, show a figure with a foot in a beast's mouth that scholars read as Odin's death. (Valhalla is not the only afterlife in the sources; for the other destination, see Hel.)
Poetry: the mead he stole
Poetry is the job most closely tied to Odin, though Bragi is the god of poetry proper: Odin owns the origin of the inspiration, and Bragi its practice. Ynglinga saga says Odin spoke everything in rhyme and that he and his temple priests were called 'song-smiths', because the art of song came north with them. Snorri's Skáldskaparmál supplies the origin story. After the Æsir and Vanir war the gods sealed their truce by spitting into a vat, and from the spittle they made Kvasir, a man so wise no question beat him. The dwarfs Fjalar and Galar killed him and mixed his blood with honey, producing a mead that made whoever drank it a poet or a scholar.
The mead passed to the giant Suttungr, who set his daughter Gunnlöð to guard it inside a mountain. Odin, going by the name Bölverk, worked a summer for Suttungr's brother Baugi in exchange for a sip, got a hole bored through the rock, slipped in as a snake, and spent three nights with Gunnlöð for three drinks, each of which emptied a whole container. He escaped as an eagle with Suttungr, also an eagle, on his tail. The gods set out vessels, and Odin spat the mead into them. In the rush some spilled, and that share, which anyone could have, was known as the 'rhymesters' share', the source of bad poetry. The rest went to the gods and to poets who really had the gift.
The poem Hávamál, 'Sayings of the High One', is attributed to Odin himself and retells the theft of Óðrerir, the vessel that held the mead. The vessel's name, Óðrerir, is usually read as containing that same óðr root.
Magic and runes: knowledge with a price
Ynglinga saga, chapter 7, makes Odin the master of a craft Snorri says was not respectable for men. His body could lie as if dead or asleep while he went abroad as a fish, a worm, a bird, or a beast. With words alone he could quench fire, calm the sea in a storm, and turn the wind. Through magic he could know a person's fate in advance, bring death or ill luck on someone, and take strength or wit from one person and give it to another. Snorri adds that this was followed by weakness and anxiety, which is why the priestesses were brought up in the art instead of the men. He also carried Mímir's head, which told him news from other lands.
The two stories behind his reputation for wisdom, the eye he gave up at Mímir's well and the nine nights hanging on a windswept tree, are told in full in MythCairn's guide to the Norse gods, so they are only pointed at here. The Hávamál version is the one scholars have compared to the crucifixion, and how much of that similarity is coincidence and how much is Christian influence on the poem is still debated.
Wisdom and rule: the All-father on the high seat
In Snorri's Gylfaginning, Odin sits in a seat called Hliðskjálf, and from it he sees all worlds and every man's activity and understands what he sees. That is the source of the title All-father: father of the gods, of humankind, and of everything made by his power. His two ravens, Huginn and Muninn, fly out at dawn and return at dinner with the news, which is why he is called 'raven-god'.
The rule side has a human face in Ynglinga saga, where Odin is a chieftain from Asaland who sets laws and collects a tax on every head in Sweden, in exchange for defending the land and paying for the sacrifice feasts, while twelve temple priests direct the sacrifices. Snorri wrote it as history and left the myth aside, a deliberate choice covered in the Norse gods guide. In the sixteenth century the Vasa kings and Swedish historians officially treated Odin as the first king of Sweden, following a list of rulers invented by Johannes Magnus.
Why the Romans wrote Mercury, not Mars
The earliest outside description cuts against the popular picture. In Germania, late in the first century, Tacitus says the Germanic peoples chiefly worship 'Mercury', and that they make human sacrifices to him on fixed days, while Hercules and Mars get only animals. Scholars read that Mercury as Odin. Anthony Birley notes the match has little to do with Mercury's classical role as messenger and more with his role as guide of the dead, and other traits may also have been seen: a staff and hat, a wandering traveller, a god of traders.
The weekday shows how fixed the identification became. English Wednesday comes from Old English Wōdnesdæg, 'Woden's day', a calque of Latin Mercurii dies. Tuesday follows the same pattern, from Týr, whom the Romans equated with Mars. So the Roman view filed Odin under the wanderer and psychopomp, the Uppsala view under the war leader, and Snorri's under the sage-king. A fourth witness is among the earliest written forms of the name: a gold bracteate from the Vindelev hoard in Denmark, dated to as early as the 400s, carries a runic line reading 'He is Odin's man'. It says nothing about which job he did.
So my answer to 'what was Odin the god of' is a list, and I would keep it as a list: each surviving source records the part of him its author cared about.