The simplest explanation would be that に designates location or destination, while へ designates a direction. This, of course, depends on the context, as particles can change a bit depending on why type of sentence it is used in. In the context of location, my above explanation should suffice.
So, in your two example sentences:
In English, both of these would be translated the same way: "I go to school"
However, when using に, you are marking 学校 as the objective location. That is the goal and destination for where you are "going." The location is especially emphasized when using に, as I understand it.
In the case of へ, this marks in which direction you are going. So you can think of it as "in the direction (the school)."