Ion channels are proteins that act as selective pores in the cell's phospholipid bilayer, allowing charged particles that would've been stopped by that hydrophobic structure to pass through, entering or exiting the cell. Ion channels achieve this by forming a tube-like structure, with one end inside the cell, one end outside the cell, and a hydrophobic middle sitting comfortably among the lipids of the bilayer.
These pores are selective, however. First, they generally let only specific ions through, using mechanisms discussed here. Second, they can allow ions through only under specific circumstances. For example, many ion channels, hiding under the sobriquet ionotropic receptors, only allow cations through in the presence of a ligand, often a neurotransmitter.
We are concerned with a different class of ion channel: the voltage-gated ion channel. Such a channel allows ions to pass only at specific voltages. Since passing ions changes voltage, the resulting voltage dynamics can be quite complicated – positive feedback loops, negative feedback loops, oscillations, and more! There are some excellent examples among the multifarious and exotic action potentials of the heart.
The mechanism by which this occurs in most cases is obvious enough that it was predicted by Hodgkin and Huxley when they first characterized the action potential. Namely, the changing charge distribution inside and outside the cell moves a set of charged amino acids inside the protein, inducing large-scale conformational changes that include the pore opening.
Experimental confirmation of this hypothesis had to wait for finer electrical instrumentation. H+H correctly predicted, however, the form of that experimental evidence, viz that the movement of these charges could be detected as a stupidly small current, more formally known as the "gating current". This was confirmed by Armstrong and Benzanilla in 1973.
The advent of more advanced molecular biology techniques has added a few more details, but not many. It is known that a particular set of amino acids located near each other detect the charge, but the exact manner that they respond is still under debate.
There is one other kind of voltage-gating: ion-block, most associated with the NMDA receptor. In these receptors, extra-cellular magnesium is attracted to the pore-lining domain at the resting potential, and so binds to it, preventing other ions from passing through. When the cell is depolarized, these ions are no longer attracted to the domain, and so they unbind, allowing other ions to pass through.
Kandel and Schwartz, 5e. The Mechanisms of Voltage-Gating and Ion Permeation Have Been Inferred from Electrophysiological Measurements. Subsection 2-7-4.
A delightful 2012 review by WA Catterall: "Voltage-gated sodium channels at 60: structure, function and pathophysiology", in J Physiol.
Armstrong and Benzanilla, 1973. "Charge Movement Associated with the Opening and Closing of the Activation Gates of the Na Channels", in J Gen Physiol.