(יט) בָּדְקוּ עַד חָטְמוֹ וְלֹא מָצְאוּ בּוֹ נְשָׁמָה מַנִּיחִין אוֹתוֹ שָׁם שֶׁכְּבָר מֵת. בָּדְקוּ וּמָצְאוּ עֶלְיוֹנִים מֵתִים לֹא יֹאמְרוּ כְּבָר מֵתוּ תַּחְתּוֹנִים אֶלָּא מְפַקְּחִין עַל הַכּל שֶׁאֶפְשָׁר בְּמַפּלֶת שֶׁיָּמוּת הָעֶלְיוֹן וְיִהְיֶה הַתַּחְתּוֹן חַי:
...
(ד) אֲפִלּוּ מְצָאוּהוּ מְרֻצָּץ, שֶׁאֵינוֹ יָכוֹל לִחְיוֹת אֶלָּא לְפִי שָׁעָה, מְפַקְּחִין וּבוֹדְקִים עַד חוֹטְמוֹ; אִם לֹא הִרְגִּישׁוּ בְּחוֹטְמוֹ חַיּוּת, אָז וַדַּאי מֵת לָא שְׁנָא פָּגְעוּ בְּרֹאשׁוֹ תְּחִלָּה, לָא שְׁנָא פָּגְעוּ בְּרַגְלָיו תְּחִלָּה.
Even if the victim was found so severely injured that he cannot live for more than a short while, one must probe [the debris) until one reaches his nose. If one cannot detect signs of respiration at the nose, then he is certainly dead whether the head was uncovered first or whether the feet were uncovered first
(ו) אָדָם אֵינוֹ מְטַמֵּא, עַד שֶׁתֵּצֵא נַפְשׁוֹ. וַאֲפִלּוּ מְגֻיָּד, וַאֲפִלּוּ גוֹסֵס. זוֹקֵק לַיִּבּוּם וּפוֹטֵר מִן הַיִּבּוּם, מַאֲכִיל בַּתְּרוּמָה וּפוֹסֵל בַּתְּרוּמָה. וְכֵן בְּהֵמָה וְחַיָּה אֵינָן מְטַמְּאִין, עַד שֶׁתֵּצֵא נַפְשָׁם. הֻתְּזוּ רָאשֵׁיהֶם, אַף עַל פִּי שֶׁמְּפַרְכְּסִים, טְמֵאִים, כְּגוֹן זָנָב שֶׁל לְטָאָה שֶׁהִיא מְפַרְכָּסֶת:
(6) A human does not impurify [others] until his life leaves him. And even someone dismembered or terminally ill, obligates in or exempts from levirate marriage, and qualifies or disqualifies one from eating Terumah [a portion of a crop given to a priest which becomes holy upon separation, and can only be consumed by priests or their household]. And so too domestic or wild animals do not impurify until their lives leave them. If their heads were cut off, even if they are convulsing, they impurify - like the tail of a lizard which convulses [after being cut off].
(ה) מָצָא עֶלְיוֹנִים מֵתִים, לֹא יֹאמַר: כְּבָר מֵתוּ תַּחְתּוֹנִים, אֶלָּא מְפַקֵחַ עֲלֵיהֶם שֶׁמָּא עֲדַיִן הֵם חַיִּים.
(5) Even if they found him [in exremis], that he can only live for a short hwile, they remove the collapse and check until his nose, and if they do not sense at his nose life then he is definitely dead - it does not matter whether they reached his head or his feet first.
עד היכן הוא בודק - אם דומה למת שאינו מזיז איבריו עד היכן הוא מפקח לדעת האמת:
שו"ת חתם סופר, יו"ד, סי' של"ח
אבל כל שאחר שמוטל כאבן דומם, ואין בו שום דפיקה, ואם אח"כ בטל הנשימה, אין לנו אלא דברי תורתנו הקדושה, שהוא מת, ולא ילינו אותו, והמטמא לו, אם הוא כהן, לוקה אחר ההתראה"
Responsa - Hatam Sofer Yoreh Deah 338
But as long as he lies like an inanimate stone and has no pulse, if afterward breathing ceases, we have only the words of our holy Torah [to rely on and determine] that he is dead, and they shouldn’t leave his body overnight, and one who is defiled by it—if he is a kohein, he is liable for lashes if he is forewarned.
Rav Eliezer Yehuda Waldenberg
Rav Waldenberg dealt with many questions of medicine and Halacha in his comprehensive volumes, titled שו''ת ציץ אליעזר. In a lengthy responsum,he addresses the question of ―brain death and organ transplantation. The main sources that lead to this ruling are the שו''ת חת''ס and .שו''ת חכם צבי
First and foremost, based on the words of רש''י, he rules that as long as the heart beats, a person is alive. He explains that the debate in the Talmud is only a matter of whether the failure to detect beating of the heart is sufficient to declare a person dead, but all agree that a beating heart is a sign of life. Accordingly, Rav Waldenberg rejects ―brain death as it is possible for the brain to die before the heart. He is not troubled by the possibility that by following the conclusion of the Talmud to check the nose for respiration a patient whose heart still beats might be declared dead, as prior to the advent of the ventilator the beating of the heart and the cessation of respiration were essentially simultaneous.