Mine warfare has been around for well over a century. But first, a definition: I define a "mine" as "an explosive device triggered by the passage of a ship".
Mines actually go back a lot further than a century. There were attempts to make working mines in the 18th and early 19th centuries. The problem was how to trigger them, as before the invention of the percussion cap, the only practical way to detonate a mine was to attach it to a ship and light a fuse. Even the invention of percussion caps did not make mines very feasible, as the firing mechanism had to be something that was both waterproof (black powder and water do not mix) and crushable (to fire the cap). Command-detonated mines were tried, but they had problems with water seeping in along the wires and disabling the charge. Mines became practical when explosives less susceptible to moisture were developed.
There are three basic types of mines and three basic methods to place mines. The types are contact, pressure and magnetic (there are also hybrids, which can be both pressure and magnetic). The three methods of placement are bottom, moored and drifting.
Contact mines are the ones that you always see in old war movies: Big round iron or steel balls with something like 200lbs of high explosives. A ship or sub would contact it and have a hole blown in her side. Bottom contact mines required very shallow waters; they were most commonly used as an anti-landing craft defense. Drifting mines are heavily frowned on by the Hague Convention of 1907, but that has not prevented their being used.
Moored contact mines were typically laid from minelaying ships. They were rolled off the stern of the ship. The anchor section contained the cabling and the wheels for being rolled off. The cable would pay out to the desired length and anchor the mine.
Ideally, the length of the cable would be set so that the mine was submerged, both so that the mines were harder to avoid and that they would not be detonated by fishing boats and other small craft. Moored contact mines can be laid in very deep waters. It is possible to lay them so that the mine case is targeted towards submarines.
Magnetic mines are triggered by the passage of large chunks of metal, namely, ships and submarines. Pressure mines are triggered by the hydrodynamic pressure generated by a passing ship. These mines can be very sophisticated and may include counters so not just the first ship to pass by will trigger them. More specialized are acoustic mines, which will activate on the acoustic signature of a particular class of ship. There was development of mines which incorporated homing torpedoes, the USN version was called CAPTOR.
Mines were first laid by specialized ships, but now are laid primarily by aircraft, at least for USN usage. They can be laid by submarine, but that requires cutting into the torpedo load, which submariners hate to do. When laid by aircraft, an enemy will attempt to spot the splashes to aid in demining. As a result, it is common practice to drop mine cases that are filled with cement as dummies. This also works because few ship captains are willing to try a minefield.
Mines could be used defensively (to keep opponents away) and offensively (the "North Sea Mine Barrage"). The threat of mines was often enough to prevent a naval force from moving into an area.
I will cover mine countermeasures in another post.
 The modern equivalent is a "limpet mine", which is attached by a frogman.
 Similar issues bedeviled the first undersea telegraph cables.
 I was told that when the Navy mined Haiphong Harbor, most of them were dummies. That might be bullshit, though, as it was a naval aviator who told me and they are famous for being bullshit artists.
See WESTPAC from the Chinese Shore
2 hours ago