For your residuals $u_i$ the median minimizes the absolute sum of the residuals, $\sum |u_i|$, compared to OLS which minimizes the sum of squared residuals $\sum u_i^2$. The median estimator is the quantile regression estimator at the 50th percentile. This means, the median estimator weights positive and negative residuals in the same way. The quantile estimator in general weights them with $\tau$ for positive residuals and $1-\tau$ for negative residuals as it is graphed in the function you posted (this function is referred to as the check function).
That is
$$1(u_i>0)\tau|u_i| + 1(u_i \leq 0)(1-\tau)|u_i|$$
where $1(\cdot )$ is the check function which is one if the argument inside the bracket is true and zero otherwise. This expression is $\rho_{\tau}(u)$. Again you can see that if $\tau = 0.5$, then we end up with $\sum |u_i|$, i.e. the median regression estimator.
I have derived the steps for going from $\rho_{\tau}(u) = 1(u_i>0)\tau|u_i| + 1(u_i \leq 0)(1-\tau)|u_i|$ to the expression $\rho_{\tau}(u) = u_i(\tau - 1(u_i<0))$ in an earlier answer which you can find here. If you follow through the steps you will see how the $\rho$ function relates to the $\tau^{th}$ sample quantile. I hope this helps.