Yes it looks like you are very successful synthesizing your knowledge of prepositions, articles, and phrases that also use the same prepositions in surprising ways
1. yes, "the" is for a specific thing, "at" is for a general location. I'm at the school, not the movie theater/grocery store/park.
2. "in" is for a specific part of a location. I'm in the school, not in the gym/garden/library/cafeteria.
3. yes, "at school" for people who are generally at that place, like students and teachers. "in the school" for people who are not generally at school, so we need to use "the" to show it is a specific place for them.
4. yes, it is about occupation here
5. yes, its about time here. I'm American, so I don't know about BE using "i'm in school" for that. But yes, BE uses prepositions in different and surprising ways. The most confusing example for me is when BE speakers say "at the weekend" where I would say "on the weekend." "at the weekend" sounds like a day is a place, which doesn't make sense. You can't stand in front of a Saturday, for example. But I can't sit on top of a Saturday either, so both ways of saying this are kind of silly if you think about it too hard.
to add a few more things. You already covered at and in, but not on. You might also think about being ON the school. I don't know what you are doing on top of the school's roof, but I hope that you are having fun and being safe.
There's also the song by Alice Cooper called "School's out." It is about school being over forever because the building has been destroyed. I'm "in" school, or school is "out." It is a fun turn of phrase I think.
thank for your question, i had to brush up on my in/at/on explanations. that was helpful for me