During a CT scan, the patient lies on a motorized table that moves through a circular opening in the CT scanner. The scanner emits X-rays from different angles, and these rays are captured by detectors to create cross-sectional images or "slices" of the body. These images are then compiled by a computer to form a detailed 3D representation of the internal structures.