Requesting info on how it works.

I know NPCs have a relative simple pathing algorithm, they will not walk around obstacles etc.

But what about stacking on eachother? I know some (if not all?) NPCs are not able to walk through eachother when following their target.

Anyone know exactly how all of this works?