The anglophone sea shanty tradition is a well-known one, and the phrase "sea shanty" is even better known. It's not uncommon, nowadays, to apply the term to every traditional song with a nautical background. But the pedantic distinction between the two made by folklorists is rooted in a history far more interesting.
It's probable that sailors have always sung to pass the time on long voyages. But we don't know what they were singing in the early days; a smart guess would be precisely the same things as the people at home on dry land. The first documented song in the English language to become associated with sailors specifically is "Spanish Ladies," a version of which was first registered with the Stationers' Company in 1624. But despite this early reference, we don't have a version of the words available to us from any time prior to the early 19th century - and that's likely not a coincidence.
Sea songs exploded in the mid 1800s, as early globalization spawned an increasingly large and self-connected population of people who lived out their lives by and on the sea, traveling to ports all over the world. "Spanish Ladies" as we know it today celebrates precisely the kind of voyage many English sailors took. It's also spawned a great many variants which will be explored in more depth in a later post.
Other notable sea songs of this era include "Rolling Down to Old Maui" (first collected in 1858) and "The Leaving of Liverpool" (known from references in the lyrics to date from the 1860s or 70s). These are excellent songs still well loved in folk music circles today. But they're often mis-described as shanties, which they aren't.
A shanty, properly speaking, is part of a specific English-language tradition that began in the middle of the 19th century and very likely fuses English and West African musical heritage. Shanties are work songs, written not only to pass the time but to pace repetitive tasks such as turning a capstan. For this reason they tend to have a strong beat and often very repetitive words so that one person can easily lead a whole group in singing them. Consider, for example, the difference in structure between "Leaving of Liverpool," which has verses alternating with a chorus in the fashion to which many modern westerners are accustomed, with that of "The Black-Ball Line" (also called "Blow the Man Down"), which offers many more chances for those who don't know all the words to take an active part in the singing. It does this by using a pattern that was common in early ballads, in which each verse consists of four lines, the first and third of which form a couplet while the second and fourth are shared among all verses. To look at another famous example, "Drunken Sailor" has a verse-chorus structure, but once the first line of a verse has been sung by a shantyman leading the group, everyone can join in - that first line gets repeated twice, and then the verse ends with "Early in the morning" before leading into the well-known chorus. "South Australia" has verses structured like those of "The Black-Ball Line, and also has a chorus.
I say above that there is probably West African influence at work in the birth of the sea shanty tradition. This is because there is no prior history of work songs used in this manner in any part of Europe - but there's a very strong tradition of that form among certain cultures in West Africa, and it was well-documented among African slaves in the Caribbean. Sailors probably picked up the idea, though not any of the specific tunes, from the way in which the utility of this tradition was displayed in the tropical colonies they visited. (The usefulness of work songs probably also helped them survive the depredations of slavers, who often sought to stamp out any piece of African heritage.) The concept was adapted to songs written within a very English tradition, with tunes that often emphasize the repetitive beat more fully than most English folk songs do to maximize their ability to help keep time.
Over time some songs became associated with specific parts of a voyage. Sharp notes, for example, that most informants from whom he collected shanties marked the last time they had to pump a ship, done after they brought it into port and thus marking the very end of the voyage, by singing "Leave Her, Johnny, Leave Her", a song reserved for that occasion.
The revival of sea songs among modern folk musicians should surprise nobody. But the revival of shanties should - they're deliberately repetitive, often quite long, and if performed in the most traditional way (everyone singing in unison, with no accompaniment and often lacking in harmony when sung by sailors not trained in vocal music) this means they tend to be boring in the extreme for listeners. Some performances avoid this by adding harmony not entirely common in the shanty tradition, as in Stan Rogers' delightful version of "Leave Her, Johnny, Leave Her", harmonized in a way that belongs entirely to the folk tradition of Atlantic Canada. Some go further than Rogers does, with a great deal of instrumental backing. This probably also has a lot to do with how other sea songs (which were typically performed on deck by those with some measure of talent) came to be conflated with the shanty tradition; there's certainly a lot of modern folk and folk-rock artists putting their own spin on songs such as "Ferryland Sealer" or "Farewell to Nova Scotia" as a modern continuation of the tradition which birthed them.