This study addresses the optimal allocation of a fleet of plug-in electric vehicles (EVs) to the stations of an EV-sharing system. The objective is to maximize the profit of the system operator. A multi-layer time–space network flow technique is adopted to describe the movement of EVs in the system. We develop a mixed integer linear programming model for optimal fleet allocation in EV-sharing systems based on the multi-layer time–space network. This study applies robust optimization and chance-constrained techniques to deal with the fleet deployment problem with uncertain and stochastic demands, respectively. While small-scale instances of the problem can be optimally solved using commercial software such as Gurobi, a network decomposition-based mathheuristic is developed to efficiently solve large-scale instances. A set of computational experiments were conducted based on the data provided by the operator of the EV-sharing system deployed in Sun Moon Lake National Park in Nantou, Taiwan. The results show the proposed models and the heuristic are able to effectively and efficiently generate optimal fleet allocations under deterministic, uncertain or stochastic demand scenarios. Two measures of effectiveness, robust price and hedge value, are examined to verify the price-paid and value-gained by applying the robust solution. The proposed approach can be used as a decision support tool to assist operators of EV-sharing systems in effectively determining the deployment of their fleets to stations considering uncertain or stochastic demands.