Lizards are a good example. If they want to gain heat they lie on warm ground then get up again when they’re too hot. They change their angle to the sun so that they can control the amount of heat they receive. To prevent themselves from overheating they find shade in vegetation or under rocks. Then, at night, they reduce the amount of heat they lose by insulating themselves in burrows.
The main advantage of being an ectotherm is that they don’t use and therefore don’t need as much energy as endotherms. In fact, it’s possible for ectothermic animals to survive weeks without consuming anything. They have a much slower metabolic rate which drops even further at night when their internal core temperature drops with the colder surrounding temperature. The disadvantage is, however, that they move more slowly at certain times of the day which makes them easy prey and inefficient predators.