Most volcanoes form along divergent or convergent tectonic plate boundaries. Volcanoes can also form over hot spots.
Credit: Most of the text of this page is derived from "Rocks of the Southwestern US" by Lisa R. Fisher and Richard A. Kissel, chapter 2 in The Teacher-Friendly Guide to the Earth Science of the Southwestern US (published in 2016 by The Paleontological Research Institution).
Image above: Explosive eruptions of Mt. St. Helens, a stratovolcano in the Cascades, Washington, on May 18, 1980. This eruption, possibly the most well-know in U.S. history, blew apart a large portion of the volcano's summit and killed 57 people. Source: Washington DNR (flickr, Creative Commons Attribution-NonCommercial-NoDerivs 2.0 Generic license).
Most volcanic eruptions occur along tectonic plate boundaries. At divergent plate boundaries, the mantle wells up where two plates pull apart, creating new crust. Mid-ocean ridges are the most common type of divergent boundary and are characterized by the eruption of bulbous, pillow-shaped basalt lavas and hydrothermal fluids. An example is the Mid-Atlantic Ridge.
Formation of a new ocean basin. The continental crust has ruptured and the rift is now flooded with seawater. Oceanic crust begins to form in the new oceanic basin. Modified from a diagram by Hannes Grobe (Wikimedia Commons, Creative Commons Attribution-ShareAlike 2.5 Generic license).
Conversely, convergent plate boundaries destroy old lithosphere at subduction zones, where the ocean floor descends into the mantle. Volcanism here results from the subduction of seawater and seafloor sediments that descend into the mantle with the subducting slab, which lowers the melting temperature of mantle rocks enough to generate magma. Explosive eruptions characterize subduction zone volcanism and create arrays of cone-shaped stratovolcanoes that mark the position of the convergent boundary. Oregon's Mount Hood is an example of a stratovolcano.
Simplified diagram of a convergent boundary at which continental crust and oceanic crust are colliding. The denser oceanic crust is subducted, or forced under, the more buoyant continental crust. The oceanic crust melts as it is subducted, and an accretionary wedge forms where the oceanic plate is scraped against the continental crust; in front of the wedge is a trench. Subduction of the oceanic crust produces magma, which wells up, causing volcanic activity. Image modified for Earth@Home from original by Jim Houghton, first published in The Teacher-Friendly Guide series (CC BY-NC-SA 4.0 license).
Mount Hood in Oregon is a stratovolcano in the Cascades. Source: U.S. Forest Service-Pacific Region (flickr, public domain).
Volcanism can also occur at a hot spot, where superheated magma plumes well up from a point directly underneath the plate. Large shield volcanoes are produced as a direct result. The mechanics of hot spot volcanism are still largely unknown. The Hawaiian Islands are examples of volcanoes formed over a hot spot.
Diagram showing the hot spot beneath Hawaii. Magma rises up in a plume from the Earth's core, forming a magma in the upper mantle. The magma rises, causing volcanic activity on the surface. Hawaii is the youngest of the Hawaiian islands and active volcanism still occurs there. As the Pacific Plate continues to move, it will eventually be supplanted by another island. Modified from a diagram by Wade Greenberg-Brand (originally published in The Teacher-Friendly Guide to the Earth Sciences of the Western US, after a diagram by Tasa Graphic Arts, Inc.).
Prior to eruption, magma ascends from the mantle to a relatively shallow (1- to 10-kilometer [0.5- to 6-mile] deep) magma chamber. Upward movement reduces the pressure on the magma until it is low enough to permit dissolved gas to exsolve (come out of solution and form bubbles). All eruptions are driven by the exsolution of dissolved gas. As the gas forms bubbles, it expands in volume and forces the magma out of the vent/chamber system onto the surface. The combination of magma viscosity and gas content can produce a range of eruptive styles, from gentle, effusive eruptions to violent explosions.