Edit: In my analysis I assumed IC≈IE and
ic≈ie since base current is usually quite small. Also note: my analysis is for ac voltage vout. From your circuit, Vout actually contains both an ac and DC component. DC component is dc voltage at collector terminal.
Before I explain an answer, I need to mention that for the circuit you've shown which is a common emitter amplifier with bypassed emitter resistor RE , the gain is not vout/vin = -RL/RE . That equation is actually an approximation to a common emitter amplifier with no bypassed emitter resistor. I'll explain that also. I'll also mention that collector current IC and emitter current IE are flowing in the same direction, ie: they are in phase. They are also in phase with the base current IB. What causes the negative sign is the output voltage being out of phase with collector current by 180 degrees.
Now onto the answer:
For a common emitter amplifier with bypassed emitter resistor (bypassed with C2):
For the amplifier to work, the NPN transistor must be biased in active region via the network R1, R2, RE, and RL. C1 is coupling capacitor which at mid frequencies can be approximated as a short. C2 is a bypass capacitor which at mid frequencies can also be approximated as a short.To get an understanding of the gain formula we need to look at the ac analysis of this circuit and use an appropriate ac small signal model of the transistor. This is shown below, using the fact that C1 is short, C2 is short, and VCC is ac equivalent to ground. Also using the t model of BJT.
Now, ΔVB and ΔVL are just small variations of VB and VL. That being said, they are essentially ac signals. We can represent ΔVB as vbe and ΔVL as vout or vRL. Now looking at the ac circuit below, it can be seen that small signal input vin equals vbe which is also equal to vre. (Note lower case letters indicate small signal quantities). Here re is the small signal dynamic emitter resistance of NPN. It represents the small signal modeling of the base to emitter diode inside the NPN. This is given by re=25mV/IC.
Now looking at the output: By ohms law and following the passive sign convention we know that vRL=vout= -icRL. Note that current flows out of positive terminal of RL. But since ic= vbe/re=vin/re, then
vout= -(vin/re)RL. And gain is then vout/vin=-RL/re.
simulate this circuit – Schematic created using CircuitLab
Now I'll explain when you have unbypassed emitter resistance:
Without the bypass capacitor C2 across RE, we must incorporate RE into the ac small signal circuit analysis. The new circuit is shown below. In this case vin equals vbe + vRE which is just equal to vre+RE (voltage over both resistors).
Now looking at the output: By ohms law and following the passive sign convention we know that vRL=vout= -icRL. Note that current flows out of positive terminal of RL. But now this time we have ic= vin/(re + RE), then
vout= -((vin/(re + RE))RL. And gain is then vout/vin=-RL/(re + RE).
For when RE >> re then you may approximate the gain formula as vout/vin=-RL/RE.
simulate this circuit