The embassy is informed and the family of the deceased are usually provided with a list of companies that will transport the body back to their homeland…suffice to say many families are shocked by the cost to bring the body home, so in many instances it’s left behind and usually after a while the country where the person expired in is buried or cremated
Civil matters are left to the family to deal with, no embassy will help with that