Full spoilers follow.
The film opens on the aftermath of Thanos's attack on the Asgardian refugee ship: Heimdall is killed after sending Hulk to Earth, and Loki dies attempting a false surrender and a failed assassination. Thanos already holds the Power Stone, and takes the Space Stone from the Tesseract. The story then follows him as its protagonist, tracking each Stone acquisition as a plot beat.
The Reality Stone is taken from the Collector on Knowhere, revealed via an illusion that also traps Gamora. This drives the film's central tragedy: Gamora had extracted a promise from Star-Lord to kill her rather than let Thanos learn the Soul Stone's location. He tries, and Thanos uses the Reality Stone to turn the shot into bubbles. On Vormir, the Soul Stone demands the sacrifice of a loved one — and Thanos throws Gamora from the cliff. The scene is the film's structural hinge: his victory is only possible because his love for her is real, which is precisely the film's most disturbing claim.
Two fronts converge. On Titan, Doctor Strange views 14,000,605 futures and finds exactly one in which they win. The Titan team's plan to pry off the gauntlet nearly succeeds until Star-Lord, learning of Gamora's death, strikes Thanos and breaks the hold. After Thanos wounds Stark, Strange trades the Time Stone for Tony's life — reversing his stated principle without explanation. In Wakanda, Shuri's extraction of the Mind Stone is interrupted; Wanda is forced to destroy Vision herself, and Thanos simply rewinds time to undo it and takes the Stone anyway.
Thor arrives with Stormbreaker and drives it into Thanos's chest — but aims for the heart rather than the head, giving Thanos time for the line 'You should have gone for the head' and the snap. Half of all life disintegrates: Bucky, T'Challa, Groot, Wanda, Sam, Strange, the Guardians, and Peter Parker, whose 'I don't feel so good' is the emotional summit. Strange's last words to Stark — that there was no other way — retroactively recast his surrender as the opening move of the single winning timeline, meaning every apparent failure on Titan was necessary. Thanos, gauntlet ruined and arm burned, retires to a quiet planet and watches the sunrise; the Russos have confirmed he is simply enjoying his victory there. The post-credits scene shows Nick Fury and Maria Hill caught in the dissolution, with Fury paging Captain Marvel before he goes — the film's only offered hope, and the sole indication that the story is not over.