Your question assumes that sanctions have exactly one goal (Do this or else) but in reality either option is a win/win for the U.S. Government. The primary reason any nation will Sanction another is to isolate the target nation from it's own economy. To make a complicated topic short, what a nation does by issuing this is effectively say "We will not exchange our currency for yours NOR will we exchange our currency for the currency of any nation that also exchanges currency with you." If the nation issuing the sanctions has an equal economy with the target this means that a third nation, when considering who to support. If there is a disparity between either economy, the nation with the larger economy is going to be the victor because that economy is more productive.
However, when the United States does it, it's almost always devastating to the target for the sole reason that since the mid 1940s, if you want to play in the global marketplace, you have to be able to exchange your currency for the United States Dollar ($USD). As one notable economist so poetically said about the state of macroeconomics, it's simply "all about THEM DOLLA DOLLA BILLS Y'ALL!" (Let the record reflect that there should be a prolonged sounding of an Air Horn with that quote.)
In all seriousness, in the past days, currency was valuable because it represented a fixed amount of a mineral commodity (or, in the case of the Japanese Yen, the rare agricultural backing) such as gold or silver (rice, in the case of Yen). But since about the 1970s, long after the USD had become a World Currency, the US came off the gold standard and instead was made valuable because of it's status as the exclusive legal tender in the United States (Legal tender meaning that within a nation's jurisdictions, trade for goods and services must accept this currency. This ability to make something valuable because it's your currency is called Fiat Currency. While any nation can issue fiat currency, only the nations with strong economies can actually back up such a bold claim. For the rest, they usually will peg their currencies to another fiat currency (in a more complicated economy reality, they actually peg to several currencies, both fiats and pegs to fiats).
USD is considered a global currency because the US Economy is the engine of the global economy. Even if you never go to the states, it is hard to break from participating in the U.S. Economy because sooner or latter, money you exchange for goods and services will translate into the U.S. Economy. And while it's not the sole global currency (The Euro is a secondary global currency as is the Yen and any other money used in G7 nations) but those economies all interact and exchange. If the U.S. says "We won't exchange our money for that nation's money unless they agree to stop doing this thing, that nation is going to find that all the other back up world currencies are going to cut you off too. Even close regional allies who are your good friends... because, well, it's all about the Benjamins.
Thus the goal of sanctions isn't to stop you a nation from doing something. If the U.S. wanted to stop you from doing something, just consider this: Where does an 800 lbs Gorilla sleep? Where ever the hell the military with more aircraft carriers than the rest of the world combined tells it to sleep, when it tells it to sleep there. But in spite of recent history, it's still not popular among the U.S. voters to send massive amounts of military blood and treasure to some puissant little nation they've never heard of because they aren't doing what we want. Sanctions allow the U.S. Government to say "If you want to do this damn fool thing, do it with your own money, not ours."
It's the economic and diplomatic equivalent of a Rich Daddy cutting off their entitled spoiled brat of a child. Remember, participating in the global economy requires access to currency from a major player. If the major players won't give you currency because it's either you or the guy with the most valuable currency, you're going to find it's hard to pay anyone anything because your currency isn't worth the paper you printed it on and it's very hard to get things you need to do the damn fool thing you wanted to do... or provide utilities or necessities to your people. What happens next is going to be different depending on how you. If you succeed in making the nukes the U.S. doesn't want to make, they'll deal with that when it happens... but the U.S. will happily remind you that nuclear scientists are not cheap and rebellions don't start when bellies are full.
And there are numerous examples of U.S. Sanctions that actually ended and the world is a better place for it. One example was the ending of apartheid in South Africa, although the U.S. was slow on joining the effort, though it was complicated. South Africa was part of the U.K. Commonwealth, Apartheid started around the same time the U.S. states were under similar Jim Crow laws, and probably most importantly (to the U.S. in the second half of the 20th Century) many of the African based organizations most vocal (to the point of causing border skirmishes with South Africa) were backed by the Soviet Union and the Cubans... you know, no good dirty stinking Communists... and, well, to the United States government, if Communists hate something, it must be good, right? (Hint: No! Thankfully, many U.S. Voters didn't need the hint to get the right answer. And before there's an accusation of bias in this, the USSR wasn't motivated purely clean motives. South African Ports were vital to the British navy's operations in the Indian Ocean and into the Pacific. They joined the opposition to South Africa in part to stick it to the west.).
To make a long story short, the U.S. put sanctions on South Africa in the early 80s (although they weren't the most strict as South Africa was the major player in the region (it had the benefit of being the big economy in southern Africa). However, with the end of the Angolan Civil War (Aka Cold War Proxy War, Africa Edition) in 1988, and Cuba pulling out direct support for communist groups in that conflict, the U.S. had little need to be gentle with it's condemnation of Apartheid. 6 years later, Nelson Mandela was elected President of South Africa and Sanctions were slowly rolled back.
In some cases, the U.S. rolled back the Sanctions without resolving the conflict that led to the sanctions on a nation. On India's Independence, the U.S. remained Neutral between the conflict between India and Pakistan and offered to assist them in that pesky problem of being on the border with dirty communists (aka China). India was thankful... but Pakistan bent over backwards to get U.S. support (Remember, They had a problem with India and a problem with China... two countries that combined meant Pakistan was not popular with governments that combined represented slightly nearly 1/3rd of Planet Earth's population.). Well, India was well aware that when two countries hate each other and one is of an interest of a superpower, generally the other one starts making overtures. So India got friendly with the USSR... who also hated China because, well, China were Dirty Filthy Stinking Communists.... but India did maintain a sort of Neutrality in the Cold War. Of course, this was the late 60s which meant Nixon, who was famous for not liking communists and unnecessary paranoia... which meant India, who was friend zoning USSR diplomatic relations with them, was clearly about to be the the USSR's best gal. And then the 1971 India-Pakistan War happened and the United States told India that they were out of line for continuing to fight Pakistan when China is waiting to pounce on the winner and that Pakistan was cool cause they help the U.S. fly all their U-2 spy planes which helped anyone who didn't want to be communists. And by "Told" I mean "parked the U.S.S. Enterprise in the Operaional Range of India and revved the Jet Engines." Close to this time, Nixon visited China to point out that while he still didn't like communists, at least some Communists weren't Evil Communists like the U.S.S.R.
Suffice to say India decided it was tired of the Cold War and looked for a solution to get what they really wanted... they wanted the U.S., U.S.S.R, and China to know that it wasn't supporting any side in the war and wanted Pakistan to stop running to the U.S. when they're mouth wrote checks their body couldn't catch. And the solution came in the form of a Smiling Budha... and by Smiling Budha, we mean code name for India's first test of a Nuclear Bomb...
But the U.S. was kind of dealing with the ramifications of Nixon's paranoia.
And for the next several decades, India and the U.S. were kind of not enemies... but not friendly either. And then India did a few more tests in the 90s and Clinton responded by sanctioning them... but India had strong British ally ties and ignored the sanctions and the U.S. ignored them ignoring the sanctions and started to try and work out their problems with India... and then 9/11 and despite everything, India offered a massive amount of military support to the U.S. as they were a major regional power in the area the U.S.'s War on Terror would be operating in spite of all their past disagreements. And so the U.S. lifted sanctions and both sides made up.
As a final note, nations aren't the only target of sanctions. Non-state actors can also be targeted. Mostly these are organizations such as terrorist groups and international organized crime rings. They tend to be effective because few nation wants to be implicated in material support of these groups because that's a good way to start a war and these groups tend to be criminal actors in their territories as well. And it's not as easy to enforce since it means identifying and freezing bank accounts held by the non-state actors within the nation's jurisdiction... and if you don't want to do the hard work, occasionally the U.S. will call up and say "Did you know that your bank has an account with drug cartels?" at which point, the heavy lifting is over.