According to Cambridge dictionary, the word forget can be followed by either infinitive or gerund. These are the sentences I took from the dictionary:
She would never forget seeing the Himalayas for the first time .
Dad's always forgetting (to take) his pills .
My difficulty is deciding which one to use in this context:
I have to walk back to my room when I forget [to bring/bringing] the key. (I use the simple present to describe my routine; something I'll do if I do the other thing.)
Is there an easy way to know whether I should use infinitive-to or gerund when the verb has two possibilities like in this case? (I've learned that I must be careful to decide infinitive-to or gerund that I'll use, although it's possible to use either, sometimes it can give another different meaning).