Simple answer: The rainbow forms at the extreme angle of deviation. Light entering a raindrop gets refracted off in a different direction, with the spherical raindrop acting as a kind of prism. If we call the relative distance from the center of the drop that the light ray strikes the drop the “impact parameter”, b, then we find that we get zero deflection at ** b = 0** (the ray striking the drop smack in the center). The deviation increases as you move outwards, until you get about three-quarters of the way between the center and the periphery, at which point the ray seems to be deflected by an angle of about 138 degrees, or 42 degrees from the “anti-solar point” (the point opposite the sun. Since the sun is above the horizon, this point is actually under the ground, unless you’re up on a mountain or in an airplane). If the ray strikes the ray beyond that point, the deflection starts decreasing again. The reason you see the rainbow about 42 degrees from the anti-solar point is that most rays striking the drop tend to congregate around there. (The ray, by the way, is refracting upon entering the drop, reflecting once inside the drop from the inner surface, then refracting again upon leaving) You also get a pretty loarge color separation there, because the different colors see slightly different refractive indices of the water that makes this “rainbow angle” sluightly different for each.
The rainbow is circular because all the points at which the drops can be located so that an angle of 138 degrees exists between the virtually infinitely distant suin, the drop, and your eye lie on a cone with the apex at your eye, and it’s rotationally symmetric.
Incidentally, the fact that the angle at which you see the bow is an extremum is important. This means that there are two impact parameters , one on either side of that ritical one for the rainbow, for which the emerging ray has the same direction, but slightly different path lengths. As long as that path length is shorter than the coherence length of sunlight, you get interference effects. The rainbow is really an interference phenomenon more than it is a refractive phenomenon. Only interference can explain the “supernumerary bands” in a rainbow, or why you get different appearances of the rainbow with varying sizes of water droplets. (Knowing the appearance of the rainbow you can actually estimater the size of the raindrops producing it. See M/ Minnaert’s classic book The Nature of Light and Color in the Open Air. For details on the math of rainbows, see R.a.R. Tricker’s book Introduction to Meteorological Optics)
Incidentally, you can see other shapes under special circumstances. There’s the secondary rainbow, much dimmer than the first, and resulting from two bounces inside the raindrop. It seems to lie outside the regular bow, about 58 degrees, and has the colors reversed, with red on the inside.
If you get reflection of the sun from a body of water behind you, or some other mirrored surface (like a lot of buildings nowadays), you can get a rainbow from the reflected image of the sun, sometimes producing a Rainbow Pillar.
You can also get effects that look like rainbows, but which aren’t, produced by refraction from ice crystals. I’ve seen many of these – some seem concave away from the sun. See Minnaert’s or Tricker’s book for details.