SHORT ANSWER
Ancient Egyptians kept cool by using, among other things,
- Mud brick walls to keep houses cool
- Windows for cross draft
- Vents in the roof to help air circulate
- Matting for window shades
- Damp reeds and water pots for evaporated water to cool the air
- Roofs to sleep on at night
- Simple, light clothing, but clothing was also dictated by fashion and status
- A headrest at night to improve air-circulation round the head
- A wet blanket to sleep in
- Tree-lined paths
Note: The Ancient Egyptians mostly lived along the Nile rather than in the desert which, as today, was largely uninhabited.
HOUSING
Mud bricks were commonly used to build homes:
The sun-dried mud bricks, known as djebat, were used to build walls
that were then covered with mud plaster and decorated in white or soft
colors. The brick walls were well suited to Egypt’s climate as they
kept homes cool in the summer and warm in the winter.
Further,
Windows were small squares, set high up in order to mitigate the
stifling summer heat and prevent dust, glare and flies from entering
the house. Windows were arranged opposite each other to allow a cross
draft or breeze to filter through; vents in the roof also permitted
air to circulate. Loosely woven matting was used as a window shade to
stifle the heat and the glare of the sun.
Water was also used:
...people hung damp reeds over windows and placed water-filled pots in
hallways. As the water evaporated, it would cool the air.
The poorer class
lived in one-room huts under roofs made of reeds, straw and grass.
Roofs also served as sleeping quarters on hot summer nights...
Nights can actually get fairly chilly in and around the desert (when travelling in Mali on the edge of the Sahara, I slept on rooftops a couple of times; by midnight, a blanket was needed).
CLOTHING
Although fashion and status also determined the way people dressed,
In accordance with the temperature, the Egyptians devised simple
styles and comfortable materials in which to dress from the earliest
eras. Cotton was a major crop put to good use, and linen, especially
the special material called BYSSUS, became the basis for clothing for
upper classes.
Source: Margaret Bunson, Encyclopedia of Ancient Egypt
The masses mostly wore light garments as the last you want in a hot climate is anything heavy. Clothing was simple for the poor:
During the hot summer months, slaves, reed gatherers, brickmakers,
fishermen, boatmen and children wore little or no clothing at all.
Nudity was not a problem, in those days.
Linen was the fabric of choice, because of its light, airy quality and
ease in mobility.
A piece of cloth was sometimes used to cover the head to protect against the sun.
Source: Ancient Egyptian Peasants
OTHER
Ancient Egyptians also used a headrest at night to help keep the head cool:
The use of a headrest not only ensured a relatively comfortable
position while sleeping, but also enabled air to circulate around the
head, an added advantage in a warm climate like that of Egypt.
Some headrests were made of wood, but the poor often used stone. These were also used in other regions around the Sahara:
In neighbouring Libya headrests were also found among the Garamantes
who ruled the Fezzan between 500 BC and AD 700. In Mali, they were
present among the Tellem, from the eleventh to fourteenth centuries
AD, and...Dogons, until the
twentieth century. Nineteenth-century headrests belonging to the
Bicharin and the Ababds in Nubia still present forms similar to those
of their ancient counterparts,...
"Ancient Egyptian Carved Wood Headrest (1550 BC to 1186 BC". Source: Finch & Co.
A number of websites, such as this one, also note the use of a wet blanket to stay cool at night. People
wrapped the blankets around their bodies and went to sleep. Throughout
the night, the heat caused the water to evaporate off the blankets,
keeping the person inside nice and cool.
Ancient Egyptians and others living in and around the desert would also undoubtedly have done many of the things which their modern counterparts do, such as cooling off in the Nile (or the Niger etc.) and taking advantage of whatever shade there was from trees (wealthy Egyptians sometimes had fine gardens with tree-lined paths and running water). Even so, religious ceremonies were often held out in the sun, and Egyptians were evidently not unused to it:
Many ceremonies were held in the open sunlight, a custom that brought
about complaints from foreign dignitaries. These ambassadors and
legates from other lands attended the ceremonies in honor of Aten and
suffered heatstrokes as a result.
Source: Bunson
(all highlighting is mine)
Other source:
A. R. David, The Pyramid Builders of Ancient Egypt