This paper focuses on the analytical properties of the
solutions to the continuity equation with non local flow. Our
driving examples are a supply chain model and an equation for the
description of pedestrian flows. To this aim, we prove the well
posedness of weak entropy solutions in a class of equations
comprising these models. Then, under further regularity conditions,
we prove the differentiability of solutions with respect to the
initial datum and characterize this derivative. A necessary
condition for the optimality of suitable integral functionals then
follows.