Damage boosting allows you to progress through some areas more quickly. The only real requirement to it is that you have enough energy to survive the boost you are trying to perform.
Colliding with some kind of damage source (enemy, spike, electricity, et cetera) will initiate a knockback (unless Samus is in an uninterruptible animation: see Kagoing). During the knockback, you can initiate a damage boost by pressing the directional pad opposite Samus's facing direction while holding jump. Samus will perform a backflip animation and travel some extra distance opposite the direction she is facing. Damage boosts cannot be performed while morphed.
The timing window in which to perform a damage boost is dependent on the damage source. Spikes and spike-like sources such as electricity provide 10 knockback frames, enemies provide 5 knockback frames, and enemy projectiles provide 4 knockback frames.
If you are not holding left or right on the directional pad when when Samus makes contact with the damage source, the initial knockback will launch Samus upwards and sideways away from the damage source (depending on if Samus' body center is to the right or left of the center of the damage source). If you are holding forwards (the same direction Samus is facing) on the directional pad when she makes contact with the damage source, she will instead be knocked downwards and sideways away from the damage source. You can use these trajectories to launch Samus higher or lower during the damage boost, especially if you initiate the damage boost a little late (letting more of the initial knockback play out).
Saving time with most damage boosts requires Samus to travel in one direction and turn around before making contact with the damage source, in order to damage boost in the direction of travel. Turning around during a spinjump is instant. Turning around while not in a spin jump takes 8 frames, so you must turn around a little earlier when not in a spinjump.
After the damage boost has been initiated, you can make it propel you even further by continuing to hold the direction you want to travel.
There are other variables that affect the damage boost, such as how you collide with the damage source and whether you have Speed Booster.
Arguably the first damage boost a runner should learn is the one on the way out of Kraid Eye Door Room, because it doesn't require a mid-air turnaround to save time.