After a defendant is convicted at trial in a federal court and when the death penalty is off the table (if it's on the table there's a different process), a sentencing process starts. This process is based around the US Sentencing Guidelines, which is a book of rules to calculate how serious all of the defendant's conduct was (on a scale of 1 to 43) and how to combine that with their criminal history to determine a recommended sentence range. The federal probation office investigates the details of the crime and produces a report applying the guidelines to the defendant; each side can make objections to this report (e.g. the defense might claim the defendant really had a minor role in the crime, while the prosecution might claim that he abused a position of trust), and the report and objections go to the judge. The probation office might also produce a sentence recommendation, which goes to the judge and might or might not go to the parties (it depends on the court).
At sentencing, the judge reviews the report and gives each side a chance to comment on it. She has to consider all of this in issuing a sentence, and if there are any disputes she has to resolve them. However, she's free to make her own decisions on applying the Guidelines even if the probation office, prosecution, and defense all agreed on something else. Also, she can depart from the Guidelines range under rules laid out in the Guidelines, or she can set it aside entirely and issue what she considers to be an appropriate sentence between the statutory minimum and statutory maximum.
For plea bargains, it can work differently (but doesn't have to). Most plea bargains will say something about sentencing, but it can be either a recommendation or a binding agreement. If it's a recommendation, the judge will consider it but can make her own decisions just like if the defendant was convicted at trial (and this isn't grounds to withdraw the plea). If it's binding, the judge can still choose to accept or reject the plea bargain. If she accepts it, she has to sentence based on the agreement; if she rejects it, the defendant can withdraw his plea.