This paper considers deployment problems where a mobile robotic network must optimize its configuration in a distributed way in order to minimize a steady-state cost function that depends on the spatial distribution of certain probabilistic events of interest. Moreover, it is assumed that the event location distribution is a priori unknown, and can only be progressively inferred from the observation of the actual event occurrences. Three classes of problems are discussed in detail: coverage control problems, spatial partitioning problems, and dynamic vehicle routing problems. In each case, distributed stochastic gradient algorithms optimizing the performance objective are presented. The stochastic gradient view simplifies and generalizes previously proposed solutions, and is applicable to new complex scenarios, such as adaptive coverage involving heterogeneous agents. Remarkably, these algorithms often take the form of simple distributed rules that could be implemented on resource-limited platforms.