Grammar
N2AI-drafted〜あげく/〜末に
after (much) ...; in the end
Formation
V-た形 + あげく(に)/末(に);N + の + あげく/末(に)
Usage
Both indicate a final result reached after a long, drawn-out process of effort, worry or trouble. 〜あげく strongly implies the outcome was bad or a waste of all that effort, while 〜末に is neutral and can introduce a good or simply decisive result, and sounds more formal/written. Both need a process that took time, so they cannot be used for a single instantaneous action.
Examples
長い間悩んだ末に、留学することに決めた。
ながいあいだなやんだすえに、りゅうがくすることにきめた。
After agonizing over it for a long time, I decided to study abroad.
彼は two 時間も迷ったあげく、何も買わずに帰った。
かれはにじかんもまよったあげく、なにもかわずにかえった。
After dithering for two whole hours, he went home without buying anything.
激しい議論の末に、ようやく結論が出た。
はげしいぎろんのすえに、ようやくけつろんがでた。
After a heated discussion, a conclusion was finally reached.