For the most part, the role of the secondary is to get help clear the beer. The idea is that you spend a week or two in the primary, then get the beer off the trub/yeast cake (to avoid off-flavours from developing) and into a second vessel. Here, the yeast and sediment will settle out even more and you can rack to your bottles more easily.
A secondary can also be good for 'bulk conditioning' which some people swear by for big beers (e.g., IIPAs, big stouts, etc.). I am one of them. Essentially, you just leave your beer in the secondary in the cellar for an extra month or two or three or four. It performs the same thing as bottle conditioning, essentially, but the flavour seems to improve better in the secondary than in the bottle. At least that's the theory.