First, make sure you get all (and I do mean all) of the loose paint off the wall. If you get a fairly flexible wallpaper scraper you should be able to bring most of it up. Keep going for that extra 5 minutes after you think you've finished.
Then sand the remaining paint to feather the edges so that they are as smooth as possible.
Next get some filler (spackle I think it's called in the states) and fill in any cracks and large holes. You can also use it over any edges that still seem harsh. When it's dry a light sand will smooth out the imperfections - but don't let it get too dry as it can go very hard.
Then wash the walls down with warm (mild) soapy water, then rinse off with fresh clean water. Allow to dry then prime the wall with either a specialist primer or a watered down coat of emulsion. This will also help find any last imperfections which you can fill and reprime.
Then the wall is ready to paint.
In my experience in painting my own house over 50 years I only sand when necessary, that is when the paint is loose, or, the surface is glossy. I just repainted some trim on my house that has Semi-Gloss paint. And, I sanded it first. I did this to improve the adhesion of the new paint. But, most of my house has flat paint, and I never sand it unless I'm blending an area where I had to remove some loose paint.
Update, 11/14/13: I re-read this today, including all the posts. It's interesting to see the different opinions about this subject. No wonder you had a question after searching the net.
My take on this is that if you are a perfectionist, you'll decide to remove it all. If you're just painting to resell, you'll scrape the loose off and paint. If you're going to keep it and use common sense, you'll scrape, sand where you need to feather edges for aesthetics, and paint. That's assuming its flat paint. For glossy finishes, you really better sand it to ensure the new paint sticks permanently. Incidentally, I always clean before scraping with Tide and bleach solution and brush hooked to expandable pole, and sometimes with a power washer to quickly knock off loose paint. Also, after sanding, I blow off the sanded surfaces with a blower, or brush it with a big paintbrush, or wipe it with rubbing alcohol or water.
Recently I used the tool below to "sand" the loose paint off my deck before repainting and was very impressed with it's efficiency. I like how it gets down into the cracks between the paint and wood and smooths out the ridges, as well as how quickly its use is. You might want to pick one of these up and give it a try.
Finally, one last tip. You can always do a test by painting a small area, waiting several days, then trying to scrape it off. That's how I learned how important sanding is for glossy paint.![enter image description here](https://i.stack.imgur.com/tt4a7.jpg)
Best Answer
If the paint is peeling, then it's time to repaint.
You probably could get away with touching up the areas where the paint is peeling, but it's difficult to get a good color match, and it's probably almost as much work to do touch-ups as it would be do redo the whole thing. If there's a scrape in new paint after only a year or so, that would probably be the time to touch up just the scraped area...
Prep is the key to a good paint job:
Enjoy another 5, 10, 15 years of nice looking paint, then do it again.