There were two basic ways for a ship to be at rest in port. One was to moor alongside a pier or quay wall (or to tie up outboard of a ship so moored) or anchor out.
In many ports, anchorages were laid out on the charts. When the navigator picked a spot to anchor, he had to lay out a proposed swing circle. The swing circle was determined by the center of the proposed anchorage, plus the length of the anchor chain payed out and the length of the ship. The length of anchor chain, or "scope", was determined by the depth of the anchorage, plus the distance from the hawse pipe and then that figure was multiplied by 7 or so.
Navy anchors had flukes on them. The scope of the chain ensured that if there was any pull on the anchor by the ship due to currents or winds, the pull was in a horizontal direction, which tended to dig the flukes into the bottom, thus holding the ship.
The ship would approach the desired anchorage from downwind or down-current. The goal was to coast into the anchorage so that there would be little way on. Ideally, the ship would coast slightly through the desired point and then drift back through. At the desired point, the navigator would recommend dropping the anchor; the Conning Officer would so order it and the order would be passed to the forecastle by sound-powered telephone talkers. At the instant that the anchor was indeed let go from the forecastle, the quartermasters would shoot a round of bearings and the chart would be marked for the center of the swing circle.
Then the ship would drift back, paying out the anchor chain. This was a little touchy, as you didn't want the ship to drift too fast and pay the chain out too fast. The ship's engines would be used to control the speed and, if the current was nonexistent, the shp would back down.
Anchor chain was furnished to ships in lengths known as "shots". Each shot of chain was fifteen fathoms long, or 90 feet. The shots were held to one another by a detachable link; it looked from a distance like a regular anchor chain link, but it could be broken apart.. The deck force used the brake on the anchor windlass to slow the chain as the desired length was reached. The amount of chain payed out was always set so that a detachable link was on deck when the chain was paid out.
Two stoppers knows as "pelican hooks" were used to hold the chain.
The amount of chain paid out would be adjusted so that the detachable link was between the two pelican hooks. In the event of an emergency or if the anchor was fouled, the detachable link would be opened, the chain broken and the outboard pelican hook would be knocked free, dropping the chain to the anchor into the water. Nobody liked doing that, for it would take a floating crane and Navy divers to recover the anchor.
If I remember right, there was about eight shots of chain for the anchor. Every link of the second-to-the last shot, known as the "warning shot", was painted yellow; every link of the last shot, known as the "danger shot", was painted red. If the ship was anchoring and the yellow and red shots came out at speed, expect the forecastle crew to run aft as fast as they could, for the bitter end of the chain was about to be ripped from the bulkhead in the chain locker and come up flailing around the forecastle.
Once the chain was secured, the navigator would plot the swing circle. There would be a watch both in CIC and on the Bridge that would plot the ship's position every fifteen minutes or so. If the ship began to drift outside of the swing circle, then the anchor was not holding and the ship would weigh anchor and get underway to re-anchor. That assumes that the anchor chain hadn't parted. If it had, the ship would either just leave port or re-anchor with the other anchor.
There is an old Royal Navy sea story about anchoring. A destroyer was making an approach to its anchorage in Hong Kong. That was tricky, both because of the currents and the large amount of ship traffic in the port, from small boats, through junks and merchantmen. The destroyer made a flawless approach and, as she made the final approach to her anchorage, the destroyer flotilla commodore had his signalmen send, by flashing light, a one-word message to the destroyer: "Good."
But then things went bad. The anchor didn't drop when it was released (possibly the anchor windlass's brake was on) and the winds and currents pushed the destroyer away from the desired anchorage. The destroyer narrowly avoided a few collisions with other traffic in the harbor.
The commodore watched all this happen and had the following message blinkered to the destroyer: "Append to my last: God."
 Or one could moor to a buoy by using the anchor chain to fasten to the buoy. I never saw this done.
 Where the anchor chain exits the hull of the ship.
 Not easily. The detachable links were supposedly color-coded to indicate the amount of chain paid out. At the end of the first shot, the link on either side of the detachable link was pained white, at the end of the second shot, two links on either side of the detachable link were pained white, and so on and so forth. Over time, the paint would wear off, though.
 In the event that this had to be done under fire, you'd want to send out the deck force seaman with a size 20 neck and a size 2 hat.
 This was a pain in the ass for some ships, such as the Knox class, which had only been equipped with a single anchor windlass. For them, the deck force had to take the main anchor chain off the windlass and then feed the other chain around it. Which was backbreaking work.
Secession? Bad Idea.
2 hours ago