Forensics
Police visit a crime scene, collect and record evidence. Then they speculate events which might account for the evidence - the speculation may be done by professional ‘profilers’.
Arrest
Entrapment
The aim is sometimes to prevent, rather than punish crime after the fact. Entrapment can lead to confession of plans; but it can also act as a way by which police informants encourage people, who would otherwise not be competent or coherent to do so, to plan and very nearly commit a crime.
Confession
Sometimes the accused confesses to the crime and provides details. Sometimes, when placed under duress (eg: torture), even an innocent person produces a confession!
Trial
The prosecution makes charges against the defendent, who can choose to be zealously defended by a lawyer (potentially appointed by the government if he cannot afford one). The trial often involves cross examination of witnesses and experts, and exhibition of evidence by either side to support their case.
Bail
While the trial is going on, to ensure that the accused does not flee to avoid potential punishment, they are often jailed. Otherwise, they may be allowed greater freedom, often short of being able to leave the country or state, in exchange for a large sum of money deposited as guarantee with the court: this is bail.
Bail money is often provided for some fees by bail bondsmen, who inturn have the authority to use bounty hunters (in USA) to bring the accused to justice if they flee trial - causing them to loose money.
Plea bargain
To avoid the costs involved in prosecuting, or to prosecute more important targets, the prosecution may convince the defendant to admit his guilt or provide testimony in exchange for a lighter sentence.
Jury vs Bench
Trials can either be jury of peers guided by a judge or by a bench of judges.
Jury decides whether the accused is guilty of the prosecution’s charges.
Errors
Jury trials have been abolished in India and Pakistan as they can be easily led and mislead by the public pressure.
Sometimes the prosecution and police, eager to close the case, coerce witnesses so much that they may lie just to end the unpleasantness - especially if they are guilty of some other crime themselves or if they are young and weak. Even in USA, many are wrongfully sentenced for serious crimes, like murder; and some are eventually exonerated after much struggle.
Sentencing
Ultimately, the presiding judge decides the correctional action/ punishment. He is often forced by law to impose a minimum or maximum penalty. Harsh sentencing has led to too many people being incarcerated in USA.
Incarceration
Incarceration happens under varying conditions. The woes of incarceration can actually be higher - even inhuman - due to criminal abuse by inmates and guards. For example, prison rape is so common in USA, that prisoners often sought protection in exchange for sex Eg: Donny the punk.
Parole
After the minimum sentence has been served by the convict, he may be eligible to be forgiven and released. A parole board convenes to check if the prisoner is eligible - he is expected to be contrite and regretful - this is a problem if a person is wrongly convicted.
In USA, federal crimes are not eligible for parole.