Typically at trial, the "Trier(s) of Fact" (usually the Jury, unless the defendant requests a bench trier, then it's the judge) will have instructions from the "Trier of Law" (always the Judge) that will allow them to find guilt for "Lesser and Included Charges". For example, in the U.S., unjustified homicide (legal definition used for manslaughter and murder) comes in three broad types: 1st Degree Murder, 2nd Degree Murder, and Manslaughter (ordered from worst to lesser offense). All the elements to convict on Manslaughter exist in 2nd degree murder, and all elements to convict on 2nd degree murder exist in 1st degree murder. This means that a jury can be given the option that if they don't think the evidence supports a 1st degree charge, they can see if it supports a 2nd degree or Manslaughter.
However, they can only convict on the charge or the the most serious "Lesser and Included" charges. They cannot find guilt for all three for the same offense.
This is not in violation of double-jeopardy as this is all presented at the same trial. Double-Jeopardy attaches once the jury is fully selected. If the jury acquits, the prosecutor cannot try for a lesser charge. They have one shot.
The only time that you can be tried for the same crime a second time is if you are acquitted and it turns out that you were acquitted because the "trier of fact" was corruptly influenced by you or people acting on your direction to find you not guilty (the idea being since the fix was in, you were never in jeopardy to begin with). In all of American Law, this has happened exactly once, so it is very rare.
Mistrials are another way to get a second trial but mistrials typically come about because of either lawyers misbehaving such that an impartial trial is no longer possible (if it's the prosecutor, they can't retry... if they could it would incentivize them to misbehave in front of a jury that is not favorable to them in the hopes of refiling and getting a more favorable jury). Mistrials rely on a legal fiction that the trial that was declared a Mistrial never happened in the first place.
If the mistrial is declared on appeal, it is only to the benefit of the convicted, so it is essentially him waiving his right against Double-Jeopardy. Depending on the reason, the prosecution may not refile the case (usually because new exculpatory evidence was found) or cannot (if they did not reveal the exculpatory evidence prior to the trial).
Edit: Since this is U.S. specific, it should be pointed out that in the United States, Double Jeopardy applies only to one jurisdiction. At any given time in the U.S., you are almost always under 2 jurisdictions (the state/territory's jurisdiction and the Federal government's jurisdiction) and as much as 7 (at the "Four Corners" you are under the Jurisdiction of four states, 2 tribal governments (which are independent of the states those reservations exist in) and the Federal Government). This means that if the state charges you with a crime and fails to properly prosecute you, the Feds can also charge you with a crime and prosecute you properly.
Typically, the Federal government will prosecute you only if there are federal laws that you violated that the state has no equivalent of OR the state has done an optionally poor job of prosecuting you or properly punishing you (we're talking 30 days jail time for 1st degree murder).
It is rare for the feds to go after common criminals and they only will go for them if the crime involves crossing state lines as an element of the crime OR the crime involves federal property. YOu are more likely to see federal kidnapping charges against non-custodial parents who take the kid to another state than you are Federal Murders. Typically, the Feds will be satisfied if the crime is tried in state court, no matter the result (it also helps them getting away with the Dual Jurisdiction rule. You can't challenge it if you aren't made a victim of it).
To give an example of when they might come in, if a non-U.S. citizen enters the United States by way of illegal crossing of the Canada-U.S./Montana Border, and then proceeds to kill a U.S. border agent in the process and is caught by Montana State Police, who can prosecute him and for what?
Montana can prosecute him for one count of 1st Degree Murder for the murder of a person under the jurisdiction of Montana (the border guard).
The Federal Government can prosecute him for one count of 1st Degree Murder for the killing of a person under the jurisdiction of the U.S. Federal Government, an additional count of Murder under the Felony Murder rule (If someone dies as a result of your illegal criminal action, that death is a 1st degree Murder) or under the law against killing a federal employee while carrying out their duties (this second option might be rolled in with the killing someone under Federal Jurisdiction).
Montana cannot prosecute the accused for the Felony murder because U.S. states cannot enforce immigration law. Therefore, in the eyes of Montana, the accused was not committing a crime that lead to someone's death. He just killed a man.
The feds will likely have Montana take first crack at the case because Montana has more immediate access to labs and evidence than the Feds and because states tend to be quicker about this stuff. Once the case resolves, the Feds will then figure out if they want to charge him for both Murder charges and the Immigration violation, only the Felony Murder Charge and Immigration violation (and accept Montana's outcome of the similar murder charge), or just the Immigration violation (and accept the outcome of Montana's trial for both possible Federal murder charges).
For academic purposes, the trial for the Immigration Charge will likely be held after the sentence for the Montana charges (if there are any) are carried out because deporting the suspect back to Canada (or his home country) will result in zero jail time because no element of the crime took place there.