If the beam is in equilibrium, then any and all portions of the beam must be in equilibrium.

Derivation of shear stress formula

We will examine a small portion of the beam element. This portion of the beam must satisfy equilibrium of forces in the horizontal (x) direction.