Here's how to make the background as blurry as possible while keeping the subject sharp.
It’s the contrast between a sharp subject and a very blurry background that makes this effect stand out. Simply setting a wide aperture and getting a shallow depth of field is not how you get this effect, because then the subject may not be fully in focus. Background blur depends not just on the aperture setting, but also on the positioning of the camera, subject, and background, and on the the focal length of the lens.
First, decide how large the subject should appears within the frame. That's the magnification (relative to the frame size, ignoring differences between formats). The magnification is an important aspect of the composition that will probably override all other considerations for sharpness and blurriness, so this procedure assumes the relative magnification will be decided first and held constant.
Next, find the largest aperture (smallest f-number) that keeps the subject entirely in sharp focus. That means the focus field must be just deep enough to include the subject front-to-back, with nothing in front of or behind the subject in sharp focus. Focus must also be set accurately to include the entire subject. Note that the subject appearing sharp on a screen (or in a print) depends on how it is viewed. If you are viewing the image on a screen at reduced resolution or from a far distance, more of the image will appear sharp (that is, the focus field will be deeper). So try to emulate the final viewing conditions as best you can. If you want the image to appear sharp according to the limit of your camera's resolution, use your camera's focus magnification feature to zoom in all the way as you are adjusting the aperture and focus. For a given magnification and format, the focus field's depth depends largely on the f-number, and is largely independent of the distance between the camera and the subject, and the focal length. So with the aperture now set, it shouldn't require much adjustment from this point on. (Though with the subject very close to the camera and with a very wide lens, the focus field is deeper for a given f-number and format.)
With the magnification and the f-number now set and held constant, background blur is maximized by maximizing the camera-to-subject distance and the subject-to-background distance. Longer focal length lenses let you move the camera further from the subject and increase the background blur while maintaining the desired magnification.
Shooting indoors, where the camera-to-background distance is constrained, background blur is maximized by placing the camera as far as possible from the background, and placing the subject halfway in between. If your longest lens doesn't give you enough magnification, move the subject closer until you get the magnification you want.
Shooting outdoors where the distance to the background is large, use your longest lens and back the camera far enough away from the subject to achieve the desired magnification. A more distant background will appear blurrier, but the effect increases more slowly as the distance approaches infinity, so don't worry about trying to make the subject-to-background distance really large.
Note that moving the camera back also changes the perspective, making background objects appear larger relative to the subject.
A note about formats and lenses: If you are shooting with high magnification, the focus field will be shallow even at moderate f-numbers, and so having a fast lens is not important. In fact you might not be able to get the entire subject in focus even at the lens’s smallest aperture setting. Smaller format cameras have lenses with smaller apertures, which can overcome this problem. If you are shooting with low magnification (the subject is far away or the angle of view is wide), the focus field can be deeper than you want even with a fast lens. Larger format cameras can overcome this problem by having lenses with larger apertures.