Optimization in the space of measures : new techniques from optimal transport