Domdaniel: White played moves 16 and 17 in the wrong order: Shak's attack was sound, but his execution of it less than perfect.
After 16.g5! Black has various picturesque ways to lose, including 16...Kh8 17.Bxh7! winning, eg 17...Kxh7 18.Nxf6+ mating. Or 17...Be7 18.Nxg7! with mayhem to follow, eg 18...Bg4!? (both the N and B are immune -- 18...Kxh7 19.Qh5+ mates, or 18...Kxg7 19.gxf6+) 19.Rxg4 Kxh7 20.Nxe8 Rxe8 21.Rg3 Bd6 22.Qh5+ Kg8 23.gxf6+! Bxg3 24.Qg5+ and mate next move.
16...Kf8, meanwhile, can be hit with 17.Nxg7, with a huge attack.
Or 16...Nxc3? 17.Nxf6+ gxf6 18.Bxh7+! Kf8 (18...Kxh7 19.Qh5+ mates) 19.gxf6 mating or winning lots of material.
These lines are far from exhaustive, but it seems that *after* 16.g5 White can throw pieces at the Black King with wild abandon, winning in every line. But by playing 16.Bxh7+!? first, Mamedyarov got into a deeply unclear and chaotic position.
Despite the similarity of some sacrificial lines, Black is able to just survive with the maneuver Bf5-g6, and finding counterplay with ...Bf4, when White has nothing more than a draw.
Beautiful game, nonetheless - even if the result was halved and much of the beauty 'in the notes'. Since White seems to be winning by force after 16.g5, Black's earlier play must contain a fatal error. 15...Nb5? is the obvious culprit -- if instead, say, 15...Qd8 or 15...Reb8 Black seems OK.