You are asking how to make the background as blurry as possible while keeping the subject sharp. That means maximizing the circle of confusion diameter for background objects while ensuring that the subject remains within the focus field.
The depth of the focus field depends largely on the magnification, the f-number, and the output resolution (circle of confusion criterion), and is largely independent of the focal length and the subject distance.
First, decide what magnification you want. (that is, how large the subject should appear relative to the frame) Adjust the camera-to-subject distance and the focal length to achieve the desired magnification.
Try to focus on the center of the subject (front-to-back), or somewhat front of center if the subject is close.
Then adjust the aperture setting to find the smallest f-number that shows your entire subject in sharp focus when viewed at the intended output resolution. If you can't get the entire subject in focus even with a large f-number, your magnification is too large: back up or zoom out. If the entire subject is in focus plus some distance in front or behind the subject distance even with a small f-number, the magnification is less than it could be. Focus may need to be adjusted slightly as the f-number is minimized to keep the entire subject in focus.
All of the following assume that the f-number and the magnification are held constant.
Reposition the camera, the subject, and/or the background as much as you can to maximize the camera-to-subject distance and the subject-to-background distance. Of course you will need to re-focus if the camera-to-subject distance is changed.
If the camera-to-background distance is limited by the available space, try to equalize the camera-to-subject distance and the subject-to-background distance while still maximizing the camera-to-background distance. When the camera-to-background distance is held constant, background blur is maximized when the subject is placed halfway between the camera and the subject.
The camera-to-subject distance may be limited by the maximum focal length of your lens. If you move the subject too far away, the magnification would be reduced.
Moving the background further and further away has decreasing returns. You don't need to move the background all the way to infinity.
All distances should be measured between planes parallel to the image plane. I derived these results from an expression of circle of confusion diameter in terms of magnification and f-number. Feel free to verify my results.