As far as my understanding is, and the cultural understanding throughout most of the middle east, you have the right to hit your child for wrong doing. It does meantion that you are not allowed to beat a child though. And also there is a hadith that explains a situation when a young child had urinated while sitting on Prophet Muhammads(PBUH) lap. The father was very embarrased and started freaking out at the child. Muhammad (PBUH) then said to the father of the child something along the lines of, "This is not a big deal. My clothes can be washed. But when you act like this to your child in public, their feelings of embarrasment can never be washed away." I have, and I feel like other muslims have viewed this as, don't make a scene in public. If you are upset at your child, punish them in the privacy of your own house, not in public.
As far as age goes, it depends on the person. I have seen as young as 2 and it's ending depends on the sex of the child. I have seen grown men get hit by their mothers slipper, or fathers hitting their son in the back of the head. But I feel that woman stop being disciplined my their parents after they get married, then it becomes the husbands responsibility.