Interestingly enough, the Mekubalim write that even when a person is awake during the night, his neshamah ascends to the heavens, either to make a reckoning for his actions during the day, or to benefit from the radiance of the Shechinah. This is mentioned by Rabbi Avraham Azulai (a”h), in his sefer Chesed Le’Avraham.
Rabbi Rafael Sharabi (a”h), the grandson of the famous Rabbi Shalom Sharabi (a”h) writes that for this reason a person feels tired and weak when he remains awake at night, often to the point of being unable to stand up straight. This occurs because part of his neshamah ascends to the heavens.
Therefore, according to the great Mekubalim even if a person stays up throughout the night, he should still recite the “Modeh Ani” prayer in the morning, before Birkot Ha’shachar, because his neshamah had ascended to the heavens during the night. This is the ruling of Ha’Rav Bentzion Mutzafi in his sefer, Orchot Tziyon.