Rate shaping is used to add a bound or constraint on the rate of a network traffic flowing through a router to a particular bit rate or a certain rate of packets per second. Rate shaping requires queues, queue management, and scheduling.
Rate shaping is often achieved by limiting the frequency of how often a queue is emptied, even if the scheduler that is servicing the queue has nothing better to do. If packets arrive with a shorter interpacket gap than is allowed by the scheduler, the packet is queued: smoothing out the burstiness of the flow.
Often, this is done by implementing a leaky bucket (which is different than a token bucket!) which allowes a packet to be de-queued every so often (every T seconds). This type of queue will always report it is empty, even if it contains data, unless T seconds has elapsed: thus ensuring that when packets arrive, they depart with at least T seconds between them.
Why would one want to rate shape traffic?
There are a couple of reasons, one technical and one emotional:
See also: Quality of Service, CQS, Token Bucket, & Traffic Engineering