Loki knows, the moment he sees the ship, that he's going to die today. Dying again will hurt. It always does. But this time, he has plans for it.
He just has to play the role first. Play his part in the story.
Make it his story. Once it's his, he'll know the ending.
"The Tesseract or your brother’s head? I assume you have a preference."
"Oh, I do. Kill him."
He lets Thanos torment Thor for as long as he dares. He can't hold out very long. The truth is, he's always disliked seeing Thor in real pain.
"All right, stop!"
With a show of reluctance (not all of it feigned), Loki draws the blue cube out from the secure pocket dimension where he had kept it hidden since Ragnarok.
Thor can't force any emotion besides exhaustion into his voice. "You really are the worst brother." But there's almost something fond about it.
Loki wants to laugh. Thor doesn't remember.
"I have seen the true power of the Tesseract, and when I wield it—"
"Who showed you this power?"
The Tesseract itself, or rather, the Space Stone. As Odin, alone in the treasure vault, Loki had devoted hours, days, weeks at a time to studying its mysteries, drawing on its power and taking that into himself, making friends with it, in a way... playing with it.
Strangely, it likes to be played with.
A mad, hysterical giggle bubbles up in his throat and then dies. He's too scared.
"I assure you, brother," he tells Thor, being as explicit as he dares, "the sun will shine on us again."
It is Thanos's biggest weakness: his inability to see past his own greatness, his own immense plans. He sees the Infinity Stones as small pieces in a larger game, as the means to an end rather than a means in themselves.
Loki knows what Thanos's endgame is. But he has also spent the last several years learning one simple, almost inconsequential thing: small pieces play large parts. Sometimes, a player has to sacrifice a piece to save the whole, giving up something powerful to lure the opponent into a false sense of security.
"We cannot keep the Aether and the Tesseract together. It is too dangerous. You, Sif and Volstagg, must take it to the being known as the Collector."
And small lies create large problems.
"I went into the temple, and I found a baby. Small, for a Frost Giant's offspring. Abandoned, suffering, left to die."
"Well, for one thing," he tells Thanos, "I'm not Asgardian."
Only twice has Loki admitted aloud that he was whelped a Jotun: once to Malekith, and now once to Thanos. And neither time has his enemy recognized the admission for the dire promise that it is.
"And for another, we have a Hulk!"
He ducks out of the way when the beast thunders forth and flings himself over Thor's immobilized body. Thanos is preoccupied and the Maw is not paying Loki any attention. He is free to slip away. "Trust my rage," he hisses into his brother's ear, reminding him of Svartalfheim and, hopefully, of the trick they had played there.
And then he vanishes.
It's easier now to disappear, to run away and hide. The Space Stone is bonded with him, likes him, whispers in his mind and tells him how to disguise things, how not to be found, how best to be in two places at once, even how to manipulate the space between the cells of his body. This is what Selvig experienced, when he was under the thrall of the Mind Stone, and what Jane Foster underwent upon being possessed by the Reality Stone. But they were human, mortal, fragile.
Loki? Loki is a god.
His own treasures are hidden in dimensions within dimensions, inside black holes reached by wormholes that can only be entered by traversing the boundaries of dying stars. Most of them are worthless to anyone else: knives, books, mementos of his mother. But there is one thing there that Loki has barely dared to think about.
The Tesseract is not the only thing he took from Asgard's vault.
He had taken it as a form of insurance; he had not been sure if Surtur was strong enough to destroy the Space Stone, and Loki could not take the chance of it simply falling into Thanos's hands. But he has never dared to think of it as a prize. The Tesseract has never been his any more than the Aether 'belonged' to Malekith.
But the Casket of Ancient Winters is his birthright, though he had always loathed it and what it stands for, and Loki has spent a good many hours studying it as well. And if the Space Stone calls Loki a friend, then the Casket calls him 'master' and longs to prove itself, and to the rightful king of Jotunheim, gives up its secrets willingly.
He has been sparing with the use of his magic, since Svartalfheim. Maintaining Odin's form hadn't taken much, and the occasional incorporeal double was child's play. He has been hoarding the Tesseract's energy, decanting it a little at a time and storing it against the day when he would need it. The stone didn't mind. It had more than enough, and he has always asked politely.
Safe in his vault, Loki closes his hands around the Casket and activates the ancient magic within. He feels the sharp, scouring cold deep within his bones and his blood, crackling down to the marrow and the mitochondria. There is a power here that makes his mouth water, it is so very eager to help, to curl itself around the very building blocks of his being and preserve them in ice. It is how he survived all those months falling through the Void, and how he was able to cling to life after being skewered by the Kursed blade. And it responds well to the energy he has drawn off of the Space Stone, what he has left of it; a chunk has already been used to teleport Valkyrie and Korg and as many of the refugees as he could manage away, to an identical, well-supplied ship in a safe, empty dimension. He will bring them back as soon as he can, but in the meantime...
He closes his eyes and imagines a knife made of ice—
No, not a knife. Too much finesse, not enough force. A hammer, that's what he needs...
His dry, cracked, bloodied lips split into a manic smile. Why not both?
In his mind's eye, he sets a knife into the space between his cells and raises a hammer made of the energy from the Space Stone. It looks like Mjolnir, the only form of that hammer he has ever been able to wield.
This is madness. But when has that ever stopped me?
He grips the casket tightly and brings the hammer down on the knife.
The power of the Space Stone explodes outward from his body like a supernova, blinding him with light and pain, light so bright and pain so intense that light becomes sound and he cannot hear his own screams, and as the power of the Infinity Gem drains out of him and begins to coalesce, the magic of the Casket flows into both him and the new form, identical to Loki, restoring and rejuvenating their cells and giving the insubstantial figure flesh and blood.
When balance was restored, both Lokis fell to the ground, gasping for breath.
"Go," Loki ordered hoarsely, flinging his arm out. "You know what to do."
His mirror image set its lips and nodded. It didn't need to speak – it had no independence of thought, no more than Loki's seidr-made copies did. Its mind was his mind, its voice his voice, and its pain... his pain.
It vanished, returning to the Statesman to confront Thanos one final time. Loki rolled onto his back and closed his eyes, seeing through his copy's eyes (Heimdall, old friend, may you find glory in the halls of Valhalla) and giving it voice, trying to give Thor courage with the one weapon that had never deserted Loki: his words.
"I, Loki. Prince of Asgard."
Hear me, brother: I am not abandoning you. This is not the end.
"Rightful king of Jotunheim."
When my life runs out, my skin will betray me. Try and remember that.
"God of Mischief."
Don't trust the evidence of your eyes. Eye. Whatever, don't grieve. Stay alive.
I will find you again.
"Do hereby pledge my... undying fidelity..."
Are you listening to me, Thor? Damn you, listen!
His copy lunges forward, thrusting the dagger at Thanos's throat, but it is stopped, as he had known it would be. His eyes go wide and his hand flies to his neck, as Thanos closes his enormous fingers around his copy's throat and lifts it into the air. He kicks frantically at nothing and begins to feel the crushing strength of that fist.
It is the critical moment. If Thanos can feel the stone's power, if he realizes that he's holding nothing more than a forged copy, then they are all lost. All of Loki's machinations, his planning, will be for nothing, and he will die here, in this barren vault, alone, too wracked by guilt to ever leave it again.
But he looks through his copy's eyes and into the eyes of Thanos, and sees nothing but smug, calm confidence.
Loki wants to smile. He wants to spit in Thanos's putrid-colored face. But his copy can barely breathe and neither can he, so he musters up a final, defiant declaration, a last reassurance to Thor (we will not be beaten by this small tyrant) and a last promise to Thanos.
"You will never be a god."
There is a burning pain in the back of his neck, and then a split-second of nothing.
Like water into a vacuum, Loki feels his consciousness being sucked back across dimensions, and then with a snap like a bowstring, he is back in his true body. A high soft whine escapes from between his lips, and with the power of the Tesseract gone and the Casket so near, his Asgardian appearance collapses and fades away, leaving the rightful king of Jotunheim lying prone and blue and bloody in the middle of a featureless gray void.
Loki draws careful, shallow breaths. His throat hurts like hell. He wants to return to Thor immediately, but he has no strength left. He needs to rest, to let the Casket restore him... and he needs Thanos to believe that he has won. Because this is his story.
And once Thanos has won... that is when the real fight will begin. And Loki will be there, no doubt to the usual universal surprise, with Valkyrie and Korg and whoever else he can find along the way.
His heart is Asgardian, after all... but his blood is not. And his enemies should know better than to trust anything about him.
Especially his death.