The prediction of the occupancy in buildings is essential to design efficient energy control strategies that optimize consumption and reduce losses while guaranteeing the comfort of the occupants. For this reason, many works address the problem of detecting, estimating, and predicting buildings' occupancy using different techniques, devices, and technologies. The occupancy prediction process can be described in four stages: data acquisition, modeling, evaluation, and testing, which are closely related. This paper reviews the most relevant recent literature on building occupancy estimation and prediction, analyzing the key aspects of its stages. A detailed description of the variables and design considerations is presented, including measurement methods, sensor selection, modeling techniques, evaluation metrics, and different applications. Through its examination, this paper elaborates significant remarks on the interaction between the stages, providing an overview of the suitable design of the occupancy prediction process. Finally, current and future trends are discussed.