Let's consider values $z_1, \dots, z_m$ and the minimizer of the function: $$ \min_q (1-\tau) \sum_{z_i<q} (q-z_i) + \tau \sum_{z_i \geq q}(z_i -q)$$
Why does minimizing this function gives the $\tau \%$ quantile?
If I plug $\tau=0$ or $\tau=1$, the formula makes sense. But for $\tau \in (0,1)$, how can we prove that the formula gives indeed the $\tau\%$ quantile?