Reconfigurable intelligent surface (RIS) can serve as a passive relay to maintain communication between a transceiver in severe scenarios of no direct link between them. In addition, harvesting energy from radio frequency (RF) signals can meliorate significantly energy efficiency. In this research, we propose RIS-aided communication systems with energy harvesting (RISwEH) which combine both RIS and RF energy harvesting to improve energy efficiency as well as communication reliability. To evaluate realistically and quickly the performance of the RISwEH, we propose the explicit formulas of the system throughput and the outage probability under the realistic scenario of Nakagami-m fading and imperfect channel state information (CSI). Moreover, we propose an optimization algorithm relied upon a Golden section search to attain the optimum value of the time splitting factor of energy harvester to obtain the best system performance. Various results corroborate the theoretical derivations, confirm the efficacy of the proposed optimization algorithm, and illustrate the influence of innumerable system settings on the system performance. Particularly, the imperfect CSI deteriorates considerably the system performance. Nonetheless, the performance of the RISwEH can be enhanced by accreting the quantity of the elements of the RIS as well as with the lower fading severity. Furthermore, the time splitting factor also impacts dramatically the outage performance of the RISwEH and its optimal value mitigates significantly the outage probability.