Death was painless. At least, physically. And though it was the middle of war, death was... Somewhat unexpected?
Fred Weasley knew he shouldn't have been separated from George. They always had each other's backs.
And then there was Bellatrix Lestrange and the Killing Curse and of course Fred died as soon as he got separated from his twin.
After the Battle of Hogwarts, Fred followed George back to their flat above Weasley's Wizard Wheezes. Why his brother couldn't see him, he didn't know. (Though he chalked it up to grief, at first, until he wondered why his brother's grief didn't let him be seen.) Why he wasn't one of the ghosts contained to the grounds of Hogwarts, he didn't know.
Within a few days of the battle was the funeral. The phrase "an out-of-body experience" couldn't have prepared Fred for the experience of showing up to his own funeral.
In the days after the funeral, Fred stayed in his own room in his flat and tried to help customers in the shop, mostly out of habit than anything. Still nobody could see him.