Here is an example you may use to start your design.
The bleed resistor has to be adjusted to the unit cell size based on a set of requirements such as how quickly you want to balance, how much heat dissipation the balancing circuit can tolerate, etc. Typical balancing currents are of the order of a few hundred mA.
There are many ways to design the logic. You can base the decision about when to balance based on relative terminal voltage differences among the series cells, in which case you may want to enable balancing when load current is zero or very low, e.g. at the final stage of charging.
Please let me know if this helped.