Many governments have committed to becoming carbon neutral by 2050. The main argument is that renewable resources are more eco-friendly than fossil fuels. However, the unpredictable nature of solar and wind power results in either excess or lack of energy generation. This article will evaluate the current machine-learning-based solutions for forecasting renewable energy demand and capacity. Many researchers have used machine learning (ML) to anticipate the amount of generated wind or solar energy. SVM, RNN, NN, and ELM are the most utilized algorithms. Prediction accuracy is improved through optimization (metaheuristics and evolution). These methods can forecast renewable energy for periods ranging from seconds to months. This article compares several ML methodologies and metaheuristic strategies and reviews the current state of research. The hybrid MLS outperforms the standalone optimizers. A more extensive data set for ANN, the introduction of NWP, and a shorter prediction timeframe are suggested as alternatives to Bayesian and random grid tuning. Further research on probabilistic predictions and mathematical relationships between inputs and outputs is needed to close the research gap.