How is an NPN relay switch circuit analysed?
The trick is, when the transistor is "on" the diode will be reverse biased, so you can ignore it. A high voltage is applied at the base, this pulls the collector low as it allows current through the relay coil. Current through the relay coil activates the relay.

When the transistor shuts off is when the diode comes into play. The transistor base is switched from high to low. This cuts off current into the collector. But the current through the inductive coil can't change instantaneously. Reducing its current only happens when a reverse voltage is applied to it. So cutting off the BJT's collector current actually leads to the collector node voltage going above the supply rail. This puts the diode into forward bias, giving the coil current somewhere to go. The coil current drops due to the voltage applied counter to the direction of current. Once the current drops near zero, there is essentially no forward bias on the diode and it shuts off, leaving both ends of the coil at the same voltage.