Bike-sharing systems (BSS) have arisen worldwide as an attractive and sustainable travel alternative. As these systems have shown positive effects in reducing congestion and emissions, it is relevant to properly analyze their potential implementation in different contexts. Evidence has shown that BSS can only provide benefits when their network is adequately designed, in order to capture ridership and generate demand. This study proposes an integrated approach to model the demand of bike-sharing trips and the optimal location of stations in the system, based on built environment and accessibility-based variables. The methodology consists of two steps. On the first step, trip generation models are estimated through multiple regressions for different types of trips and periods of the week. On the second step, maximum demand coverage models are developed to allocate the BSS stations, according to the trip generation models and to different proposed scenarios. To test the proposed methodology, information from the BSS of Santiago de Chile is used. Results suggest a relationship between the built environment and the use of public bicycles, with a main effect of residential and office land uses, and the presence of long bicycle lanes near the stations. In addition, the presence of endogeneity, associated with the location of BSS stations and BSS demand generation, is confirmed and controlled using accessibility variables. As for the optimal location models, their outcomes differ significantly from the observed spatial distribution of stations in Santiago, with higher density in central areas and along corridors with cycling infrastructure. The forecasted demand level for the optimal distribution of stations is 64% higher than the observed demand. This study confirms the benefit of an integrated modelling of the trip generation and the station location to foster higher public bicycle usage, a relevant point for BSS decision planning and the promotion of a more sustainable mobility.