The Shulhan Aruch (O.H. 127:1) writes that when the Shliah Tzibur reaches Modim during the repetition of the Amida, the congregants bow and recite Modim Derabanan, but should not bow excessively. Indeed, the Arizal says that although one should bow during Modim of the silent Amida, when comes to Modim Derabanan, one should only bend one’s head forward. The Siddur Bet Oved and the Ben Ish Hai (Parashat Teruma) concur with this Arizal’s opinion. The Kaf Hahaim (K.H., O.H. 127:2) makes no distinction between Modim of the silent Amida and Modim Derabanan, and says one should bow for both, but this is not the common custom.
Interestingly, Rabbi David Cohen-Scali (Kiryat Hana David, vol. II, Orah Haim, § 17) comments on the syntax of the words of Modim “Umagen Yishenu Ata Hu Ledor Vador Node Lecha…” He posits that this should be understood as meaning that Hashem is our shield and savior from generation to generation, and that we should thank Him. Rabbi Ovadia Yosef in his gloss to Kiryat Hana David (brought down in Yabia Omer, vol. VIII, §11:19), based on Tehilim 79:13, questions this reading and says that the phrase should be separated between the words Ata Hu and Ledor Vador, such that the meaning is that Hashem is our shield and savior, and that we should thank Him from generation to generation.
Summary: One should bow one’s head when reciting Modim Derabanan.