Because they do not have eyelids, butterflies always have their eyes open. It's probably more accurate to say they become inactive. They typically hide amid foliage or hang upside down from leaves or twigs in trees and shrubs. At night, they drowse in evergreen and broad-leaved trees and shrubs, fallen leaves, pieces of bark, or in a rock crevice or brush pile where there are many nooks and crannies.

Some butterflies go through a cycle of suspended development, a hibernation period known as diapause. Most Swallowtails hibernate as chrysalides while the American Painted Ladies hibernate as adults. The blood of some butterfly species contains the natural antifreeze agents glycerol and sorbitol. This allows them to live certain stages of their life cycle in subfreezing temperatures. During this period, their development comes to a standstill and vital functions are kept at a bare minimum.

Where do butterflies sleep? If they aren’t around at night, they must go somewhere. Butterflies are cold-blooded and need the sun’s warmth to keep their activity levels up. When it's dark or cloudy they become inactive, close their wings, and rest. Most will find a safe place like the underside of a leaf, a tree, or a rock crevice.

Butterflies will also warm themselves on rocks or hanging out on bushes during the day. It has been speculated that some butterfly wings, like those of the Gulf Fritillary, have silvery, shiny undersides that act like solar panels to capture the sun’s warmth.

Most butterflies sleep alone, but there are also species that sleep in groups. Poisonous butterflies have a particular smell that protects them better when they sleep together. One species, the Marpesia berania from Costa Rica, sleeps in groups on leaves. If one butterfly of the group is disturbed, it opens its wings and touches its neighbors. Being touched, they all open their wings as well and the whole group is informed about the danger and can escape together. If the temperature gets too hot, they will reposition their wings to minimize exposure to the sun.

Butterflies are great motion detectors and can be surprisingly fast fliers. They will inevitably fly if you or a predator approach. Your slightest movement and even your shadow can trigger flight. The only hope for a photo is to approach very slowly and steadily with no jerky movements.

As a general rule, brightly colored butterflies are either poisonous or are mimics of a poisonous butterfly and will advertise that fact. Butterflies that birds might find tasty are typically well camouflaged or just drab.

A Monarch butterfly searching for nectar or a mate on a humid summer afternoon is suddenly faced with a fast-moving thunderstorm, gusty winds and large raindrops. For butterflies, this is not a minor event. An average Monarch weighs roughly 500 milligrams and large raindrops have a mass of 70 milligrams or more. A raindrop striking a Monarch would be the equivalent of you being pelted by water balloons having twice the mass of bowling balls.

Lepidopterists report seeing butterflies darting into protective vegetation and scrambling beneath leaves when dark skies, strong breezes, or the first raindrops signal an imminent storm. During heavy rains and wind, butterflies are rarely seen. Not only does rain pose a direct threat of injury or death, but cool air associated with storms may also reduce temperatures below the thermal threshold needed for flight.

In preparation for flight, these aerial acrobats expose their wings to direct sunlight which rapidly warms their flight muscles. Overcast skies limit their ability to gather the solar radiation needed to take flight. A butterfly knocked from the air by raindrops faces the double threat of crashing in an inhospitable habitat where predators lay in wait and then being unable to warm its body sufficiently to regain flight. Small wonder that when skies darken, butterflies seek shelter in their nighttime homes. If the temperature gets too hot, butterflies will reposition their wings to minimize exposure to the sun.

(Commercial butterfly houses don't work because the majority of butterflies overwinter as an egg, pupa or chrysalis and not as adults.)
Butterflies are great motion detectors and surprisingly fast fliers. They will inevitably fly away if you or a predator approach. Your slightest movement and even your shadow can trigger flight. A photographer's only hope to get a picture is to approach very slowly and steadily with no jerky movements. Butterflies are quiescent when it's dark and take refuge in protected locations called roosts within one or two hours of sunset. Roosts may be tall grasses, perennial herbaceous plants, tangled thickets of woody shrubs, undersides of large leaves, caves or, in some cases, man-made objects such as fences or hanging baskets. Butterflies may also roost in the vegetation beneath overhanging trees. The leaves of the upper canopy block raindrops and reduce their impact below.
(http://www.uky.edu/hort/butterflies/all-about-butterflies; http://blog.perunature.com/do-butterflies-sleep; https://www.scientificamerican.com/article/what-do-butterflies-do-wh/; https://garden.lovetoknow.com/wiki/Facts_About_Butterflies)