Arduino 5V output - Switch a device on/off with relay

The "backward" diode gets placed across the relay coil. The coil, being it's a coil, has an inductance, it's an inductor, and inductors store a charge (hundreds of volts, for microseconds) - and they release that charge when they're de-energised. The diode provides a low-resistance path for that charge (discharge). That's it in a nutshell.
You don't have to sweat base resistor values for idealised collector current v. h_FE, etc. - anything 1K-5K? ought to get it good enough.