Gas exchange is the process by which gasses are transferred either in or out of through a layer called a specialized respiratory surface. Gas exchange occurs through the layer of the alveoli. When you breathe in, your diaphragm tightens. The oxygen you inhale goes down your windpipes and into your lungs. It goes through your your bronchial tubes and enters the alveoli. Hemoglobin, a red blood cell protein helps the oxygen enter the capillaries. This happens through the process of diffusion. Diffusion doesn't require any energy. It's the movement from high concentration to low concentration. There is a low concentration in the capillaries and a high concentration inside the alveoli so the oxygen diffuses into the blood stream.
The oxygen then enters your cells. Cellular respiration is performed in your cells in the mitochondria using the oxygen. In cellular respiration, glucose is broken down in the presence of oxygen and water, and carbon dioxide and energy are released. The energy is called ATP and it's necessary for survival. It is what fuels humans and animals.
In order for the carbon dioxide to leave your body, it diffuses into the alveoli. It is then exhaled out. 
Scorpion Gas Exchaange
Scorpions use book lungs to breathe. They are hardened pockets on their stomachs.  They're called book lungs because they look like the pages of a book. (see images to the side). There are layers of tissue called lamellae on top of one another with air pockets in between that are filled with scorpion blood called hemolymph.  Gasses such as oxygen are diffused in. Inside the blood, there is hemocyanin that serves almost the same purpose as hemoglobin in humans. It helps to transport oxygen throughout the scorpions body.