When a drop of water is placed on a rough surface, there are two possible extreme regimes of wetting: the one called Cassie-Baxter (CB) with air pockets trapped underneath the droplet and the one characterized by the homogeneous wetting of the surface, called the Wenzel (W) state. A way to investigate the transition between these two states is by means of evaporation experiments, in which the droplet starts in a CB state and, as its volume decreases, penetrates the surfaces grooves, reaching a W state. Here we present a theoretical model based on the global interfacial energies for CB and W states that allows us to predict the thermodynamic wetting state of the droplet for a given volume and surface texture. We first analyze the influence of the surface geometric parameters on the droplets final wetting state with constant volume, and show that it depends strongly on the surface texture. We then vary the volume of the droplet keeping fixed the geometric surface parameters to mimic evaporation and show that the drop experiences a transition from the CB to the W state when its volume reduces, as observed in experiments. To investigate the dependency of the wetting state on the initial state of the droplet, we implement a cellular Potts model in three dimensions. Simulations show a very good agreement with theory when the initial state is W, but it disagrees when the droplet is initialized in a CB state, in accordance with previous observations which show that the CB state is metastable in many cases. Both simulations and theoretical model can be modified to study other types of surface.