give up the ghost

give up the ghost (to die) — испустить дух, почить в бозе, приказать долго жить (скончаться, умереть)

Example 1:
Example 2:

give up the ghost {humorous, of inanimate objects} (stop operating) — испустить дух, почить в бозе, приказать долго жить (=окончательно сломаться {о неодушевленном предмете})
If a machine gives up the ghost, it stops working

Example 1: My poor old car finally gave up the ghost. (McGraw-Hill Dictionary of American Idioms and Phrasal Verbs)
Example 2: He had not been to town since spring because his car had given up the ghost. (thefreedictionary.com)

Example 3: We've had the same television for fifteen years and I think it's finally about to give up the ghost. (thefreedictionary.com)

give up the ghost (to stop trying do something because you know that you will not succeed; lose spirit; lose enthusiasm) — отказаться от попыток (сделать что-л.), отчаяться делать что-л.

Example 1: …Casting my memory back a long way to maths lessons I could just about understand fractions (a quarter times a quarter was a sixteenth) where timesing two things together gave us a lesser product but my brain gave up the ghost when it came to doing the same things with negative numbers.
Example 2:

=====
"Ghost" is the obsolete word for 'soul' or 'spirit'
The phrase is found frequently in the Bible to mean 'die', though in modern use it is jocularly applied to a piece of equipment, occasionally to a person that ceases to function.

For more death-related idioms see links at
[откинуть копыта]
[kick the bucket]