If you say the bracha of Hamapil then you have to go bathroom, after you go bathroom are you permitted to say the bracha?
Why yes or why no?
Yes you are allowed.Kitzur Shulchan Aruch says so. You do not repeat shema or hamapil. Sh"t Yechave data 4:21, Sh"t Tzitz Eliezer 7:27, Sh"t beer Moshe 1:63.
If you forget to say maariv or kidush levana. You can wake up to say the say them both. You do not repeat the Beracha either.
Do not repeat anything if you have to say asher yatzar. Normally, a yid (Jew) who is yiras shamayim should make sure he does not have to use the bathroom before sleeping and davening.
Please ask more questions if you would like.
Rav Shlomo Zalmen Aurbach ZTL, quoted in Halichos Shlomo 13:24; Shailos Utshuvos Yisa Yosef vol. 4 #55 quoting Rav YS Elyashiv ZTL; and Shailos Utshuvos Rivivos Ephraim vol.1 #180 all say that one should say the bracha on thunder and lightning when heard after bedtime krias Shema.