I lightly tamp. Then kind of swirl it about to make sure the walls are coated and dump it in an ash tray. I try to be careful so I don't lose any unburnt tobacco.
Also, be sure to not empty ash into a trash can. I use another metal tin can for ashes at least a day old. Then I dump that on the flower beds from time to time. Ashes can hold hot coals for hours, so it pays to be careful.
I'm sure you'll see a variety of preferences here, but I do both. Early on in a bowl I tend to gently tamp it down, but from about the middle on, I tend to gently dump the ash. What works for me is to tamp it down a bit, re-light and puff for a few minutes, then turn over and dump the ash. I find I seldom loose any unburned tobacco but just the powdered ash. Also (and this only works because I smoke outside) I will sometimes gently blow over the top of the bowl and the fine ash will blow out.
The only time I dump ash during a smoke is when I accidentaly drop my pipe. Not dumping ash may stem from my memories from an early science class where we put ash on a sugar cube to make it burn. Not that I burn sugar cubes in my pipe but to use the catalyst effect of ash.
I very lightly tamp the ash, using the weight of the tamper alone, and usually try to "bank" the ember such that the front is lower than the back, keeping the surface more perpendicular to an imaginary line drawn through the center of the surface of the ash and the draught hole. That sounds more complex than it is...
I've sometimes seen people tamp with too much pressure, and then complain about not being able to keep their pipe lit. (I was one of those, and will be ever grateful for my early mentors who taught me not only that this isn't necessary, but that it also results in a less pleasant experience.)
With taller bowls, the stack and chimney shapes, I usually find it necessary to dump some ash during second half of the bowl. A thin layer of ash on top helps to keep the embers smoldering. If the ash gets too thick, it blocks the airflow, extinquishing the fires, and making it difficult to get the tobacco going again.
You know, I've never consciously dumped the ashes before the end of the smoke. I usually prefer to continual tamp w/ a wooden dowel tamper (Tsuge actually makes such an item which we in the Phila area all rec'd during a slow smoke event), then dump ashes at the end of the smoke. I found that leaving the ashes actually enhances the smoking quality, much like banking a fire.