"You actually are joking, Perce... I don't think I've heard you joke since you were - "
-- Fred Weasley's last words (DH31)
During the Battle of Hogwarts, an explosion blasts a hole in the side of Hogwarts and kills Fred, who had just been reconnecting with Percy as they fought Death Eaters side-by-side. Fred had been surprised and delighted to hear Percy make a joke. Percy takes Fred’s death extremely hard, clinging to his brother’s corpse before going after Death Eaters with more anger and determination.
Regarding the "literary alchemy" of the series (source: hogwartsproferssor.com), Fred's completes the series of deaths marking black-to-red process of the final three books: Sirius Black dies in OP35 and Albus (meaning white) Dumbledore dies in HBP27. It is very likely that Rubeus (meaning red) Hagrid, of whom Rowling has said she almost killed off in DH and that that would have been "natural" (source: Entertainment Weekly) was originally intended to be the one killed to complete the process. She chose to keep him alive, and killing one of the red-haired Weasleys makes sense as an alternative. -BB