Some artists really struggle with creating a background for their piece if they are doing any kind of portrait.
An artist needs to know before or at the start of their painting what the background is. If they don’t, the rest of the painting can look very imbalanced. Art needs to be created simultaneously. Often an artist will struggle with one piece of their canvas. And be frustrated that this one section is not perfect. But when an artist makes sure to pay attention to all parts of the canvas, equally, a lot of that frustration will vanish. As each piece ads to the other parts of the image. And the entire piece begins to flow.
I have been painting long enough that I have a general idea of the types of backgrounds that work well with my subject matter. And so I now tend to stick to background choices that have worked for me in other pieces. There are two reasons for this. 1) Once something is working there is no need to stop using it. 2) This way people can put more than one piece of my art together in a consistent way on their walls.
That said, there are invariably pieces which are new, or where I am trying a new color palette or subject matter, and I need to figure out the background. This can be a trial and error process. And can be one of the most frustrating parts to creating a new painting.
And even once a background is determined, there can still be issues with where to put the color transition, or how much of a color value you wish to create in the background. Changing where a color variation occurs by even an inch can at times make a big difference in the overall composition of the painting. The other key piece to background creation is bringing color through the painting. This is another reason for painting all pieces of the painting in sync with one another. You may not know it, but often an artist will bring some of the foreground color into the background, and vice versa in very subtle ways. This helps the eye take in the entire piece and feel it flow.