There seems to be an idea that it is possible to be able to divine when a person will die. The Chizkuni mentions (on Vayikra 16:21, "בְּיַד־אִ֥ישׁ עִתִּ֖י הַמִּדְבָּֽרָה׃ ") [from sefaria]
“by the hand of a man especially (temporarily) appointed for this task.”According to a Midrashnot found) the word: עתי, “which could be translated as: “whose time had come,” this is someone who was destined to die before this year is out. This would account for the fact that it was noticed that the man who had been entrusted with this task never lived out that year. [A well known commentator, author < of k’lee yakar, written several hundred years after that of our author, by the name of Shlomoh Efrayin ben Aharon, quotes this commentary, but attributes it to our author. Ed.] We must assume that in those days people used astrology to determine who was not destined to live out the year.
In Esther, 1:13, the Malbim comments that the men who were "yod'ei ha'itim",
היו יודעי העתים רוצה לומר שהיו בקיאים בחכמת המזלות
though he doesn't connect the mazalot to death, one of the ones named is Memuchan, whom the Gemara in Megilla 12b identifies as Haman, and Haman was an astrologer (http://www.koshertorah.com/PDF/purim.pdf page 5). So there seems to be an idea that one can figure out when someone is suitable for death or when one will die.
If that is the case, then what value is there in praying to be inscribed in a "book of life"? If someone knows that X will die this year, wouldn't it be better to let X know this (in fact, one could suggest that being chosen to be the one who accompanies the se'ir into the wilderness might be such a notification)? But then that would contravene Kohelet 9:12 כִּ֡י גַּם֩ לֹֽא־יֵדַ֨ע הָאָדָ֜ם אֶת־עִתּ֗וֹ .
This is supported by Shabbat 153a (via dafyomi)
(Mishnah - R. Eliezer): Repent one day before your death. (m) Question (Talmidim): One does not know when he will die! (n) Answer (R. Eliezer): Therefore one should repent today, lest he die tomorrow - this way, he repents every day - "B'Chol Es Yihyu Vegadecha Levanim v'Shemen Al Roshcha Al Yechsar".
Are there any sources which discuss the idea of others' knowing when a person will die and how that should affect how he is dealt with, or how he should behave?