During a CT scan, the patient lies on a table that slides into a large, doughnut-shaped machine. Inside the machine, an X-ray tube rotates around the patient's body, taking multiple images from different angles. These images are then processed by a computer to create cross-sectional slices, which can be examined individually or combined to produce a three-dimensional image.