"I left my umbrella at school."
- で is generally used as the method by doing something. So A)スプーンで食べた I ate with a spoon B) 英語(えいご)で話した I spoke in english C)自転車(じてんしゃ)で学校(がっこう)に行った I went to school by bicycle.
Or a location of an action such as D)図書館(としょかん)で勉強した I studied in the library.
に on the other hand isnt concerned with locations or actions, but the time/date of an action 午後(ごご)一時に買い物(かいもの)しようと思います。 I think I'll go shopping at 1pm. OR the destination of a motion verb(iku is a motion verb see example 1C to see the contrast between de and iku) OR to indicate the recipient with giving verbs or any action ロラに食べ物をあげた I gave Lola food (to lola, i gave food) OR to indicate the giver in a receiving verb ロラにボールをもらった！ I got the ball from lola! OR the location of someone or something (pretty sure thats what this question is, but another example would be good) かさはかばんにあります！ (My umbrella is in my bag!^-^)
So those are some examples to help you differentiate between the different uses of de and ni. For me its easier to think if で is an appropriate use, and if not just go for に rather than the other way haha. The confusing part of this is that the verb forgot is there, but maybe it's because the forgetting to place in more than one location? Like the kasa is for sure in the school (かさは学校にあります)but like they forgot the whole time they traveled away from school sort of thing. Im not sure tbh.