A major part of it is simply blood oxygenation (O2) and levels of carbon dioxide in circulation (CO2). Breathing rate and form determine these, and effects such as light-headedness and fatigue and blood pressure depend on them.
First... you get dizzy because you aren't getting enough oxygen. You need oxygen to function. This includes your vestibular system, which, when unoxygenated, makes you feel a sense of imbalance, or dizziness.
Second... CO2 reacts with the water in your blood to form the pH-lowering carbonic acid (H2CO3). In parallel, dissolved oxygen contributes somewhat to alkalinization (pH increase from baseline). When you hyperventilate as it works very much like "exhaling with resistance". In exhalations, lungs expel CO2 out from circulation. When you hyperventilate, or breathe more than necessary, you eliminate more CO2 than usual, which makes your blood more alkaline (incidentally this is why hyperventilating into a paper bag helps: the bag retains expelled CO2 you can breathe back in). More acidic blood can also lead to dizziness, which would be the case if you were not completing exhalations - or "exhaling with resistance"). Now, this explanation is a simplification, because blood has a buffer system that keeps pH steady. It's called the bicarbonate buffer system. In lieu of this, you'll find that you are more dizzy when bicarbonate levels are increased too, so it's not directly related with blood pH in the short term.
There are probably other contributing effects too. These are probably related to blood pressure (divergence from regular blood pressure, either hypo- or hypertension cause dizziness) as it relates to breathing pattern. This is because blood circulation and respiration are coupled in many ways.
Addendum: when you exhale but don't let the air out, it's called a Vasalva maneuver. It has physiological effects too, often short-term - grunting when lifting things is an example. You can read up on it too, it could be related to your query.