In the example, we will start off with the following image:
The first thing we will do is to create a new layer. Then choose the Gradient tool and create a new gradient by clicking on the current gradient in the toolbar at the top:
We should get the window below. Add a gradient like the one shown below by clicking just below the color bar to add markers. These markers can then be set to different colors and a gradient is formed:
Once we have created our gradient and have it selected for use, make a selection with the Marquee tool like so (the height will be the thickness of your rainbow):
Now choose the gradient tool again and make sure you have the rainbox gradient selected to use and that we're in the new layer we created, then click and hold the mouse cursorat the top of the selection and then drag to the bottom whilst holding Shift. This will allow for a perfectly vertical gradient.
When we release the mouse button, the gradient will be applied:
Now we have a rather dramatic rainbow, press Ctrl+D to deselect, then goto Filter > Distort > Polar Coordinates. Choose Rectangulr to Polar, and we should have something like this:
Select the bottom half with the Marquee tool and delete it. Then goto Edit > Transform > Perspective. Drag the top-right corner up a little to change the perspective:
Right-click the rainbow whilst still transforming, and choose Scale. Make the rainbow bigger and then double-click it to apply when you're happy:
Now position the rainbow where you want and goto Filter > Blur > Gaussian Blur. Choose a value that blurs all the colors nicely. I used 7px.
Now to get the rainbow in the background we can duplicate the part of the image that it's covering. Make a selection of the area we want the rainbow to be behind, like so:
I used the Quick Selection tool for this, and then simply copied from our original image, pasted into a new layer and arranged the layers so the rainbow was beneath.
Finally, reduce the opacity of the rainbow layer to around 15-20% or whatever looks best for you. You should have something like this:

