The inner ear detects motion forward and backward via the utricle containing the otolithic membrane (which appears something like a slab of gelatin.) On this membrane are objects called otoliths that look like salt crystals.
As a person moves forward and backwards (or side to side), the inner ear works as the otolithic membrane moves with the otoliths (salt crystals) on top. Little hair cells in that membrane detect motion and tell our brain that we are moving forward and backward or side to side.
Occasionally one of those otoliths will break off and float in the semicircular canals. These canals also have little hair cells in them and when we move, the liquid in the inner ear moves past these three different canals and tell our body about our diagonal and rotational movements.
If one of the otoliths gets caught in one of the semicircular canals it results in dizziness. This is called benign paroxysmal positional vertigo or BPPV. This vertigo is intense and can last 20-30 seconds, usually after a position change. It will usually cause your eyes to rapidly beat to the side that is affected in a condition called nystagmus. This can be tested and treated usually in a few sessions.