As Bellatrix stands holding Hermione, the chandelier over her head crashes onto her - Dobby's work - and in the commotion that follows, Harry, Ron, Hermione, and Griphook manage to grab [Gryffindor's sword] and [Apparate] to [Shell Cottage], and to safety.

Landing by the sea, Harry breathes a sigh of relief, but when he turns to Dobby realizes that he has been hit by Bellatrix's knife. He yells for help, but before anything can be done, Dobby is gone.
In the garden of [Shell Cottage], Harry kneels over Dobby's body as Bill, Fleur, [Dean], and Luna gather around him. Finally, he decides to bury the house-elf himself, and Bill provides him with a spade to do it.
As the night wears on, Harry digs Dobby's grave, thinking to himself about [Horcruxes] and [Hallows], Voldemort and Wormtail, [Grindelwald] and [Dumbledore]. And as he digs, he discovers he can now shut Voldemort out of his mind, and that he knows what it is he now has to do.
Ron and [Dean] come out to Harry as dawn breaks, and they are soon joined by the others in burying Dobby, with Luna saying good-bye for them all. As the others depart, Harry remains behind and finds a gravestone, which he marks: "HERE LIES DOBBY, A FREE ELF."
Harry finds Bill talking to the others in the living room, where he learns that the Weasleys have all been moved to safety and insists that he talk to Griphook and [Mr. Ollivander] right away.
Harry stands washing his hands, thinking about where Dobby came from, about how [Dumbledore] had forseen what would happen to Ron, and to Wormtail, and to Harry.
Back in the sitting room, Harry insists on talking to [Ollivander] and Griphook immediately, with Ron and Hermione joining him. After a moment of decision, he has Bill lead them to Griphook first.
Harry finds Griphook in bed, healing, surprised and impressed at how Harry buried Dobby. He then asks him for help in breaking into the [Lestranges] vault at [Gringotts], and - despite some rudeness from Ron - Griphook agrees to consider the request.