Kevin Raber's articleHaving Fun with Panoramasis a great introduction to the process of creating a large image by combining smaller, overlapping pictures. For that article, he assumed that the result would look just the way you want it, needing only horizontal adjustment and cropping. Sometimes things do work out that nicely, but it isn't common. Most of the time, you need additional processing to make things look right.
I used to use Photoshop'sLens Correctionfilter to make vertical or horizontal lines parallel. But for the last couple of versions, Photoshop has provided theAdaptive Wide Anglefilter, which is even more powerful. Lens Correction assumes there is a single vertical and a single horizontal direction and all of the image is modified relative to that.Adaptive Wide Angleoverlays a mesh on the image, and different sections of the mesh can be distorted in different ways, allowing more sophisticated corrections.