Most are located along the edges of crustal plates, especially it seems
the Pacific plate. A few are located over 'hot spots' (example:
Hawaii's Kilauea volcano).
Now many on the edges are either near where the seafloor is spreading or where one plate is going under another (subducting).
A full 1/4 of the active volcanoes on the planet are located in
Indonesia (an area where 3 plates are involved). However the entire
Pacific ocean has volcanoes scattered around it.