According to the RAW on PHB page 132 under the heading "Disengaging From Combat", a Hasty Disengagement will incur the following;
1) -2 ac against all attacks until the end of the turn
2) A free attack granted to any opponent you are in combat with. (whether this means any adjacent opponent is less than clear as you may be in an adjacent square, but the opponent may be facing away or is engaged with another pc)
3) Up to the characters full movement.
Note: While it is not specifically stated, I would also take away any shield and Dex bonus to ac, and since you would presumably face away from your enemies as you flee. That would also grant them a back attack or flanking bonus to their BTH.
A Fighting Disengagement would incur the following
1) Loss of any action other than 1/2 normal movement
2) No penalty to ac
3) No Free Attack for opponents
Note: I would presume you maintain your facing, along with shield and dex bonuses but the rules dont directly address that.
The Fighting Disengage is useful in a situation where you want to stay in the fight but need to rearrange your front line, or want to have your melee classes act as the rear guard in a retreat situtation.
Also, there is an excellent example of this topic in the PHB page 139-140 under the heading "Example of Play".

I would also like to add my 2 cents on example 2 in the picture. Where the player was not in an adjacent square to Orc 1 and he skillfully stepped directly into his flank and then away, I would not give Orc 1 a free attack. Where he first moved into an adjacent square to Orc 2, before stepping to Orc 2's rear, I would not give a rear attack bonus to the player.
ETA: I should also add that in the example on pages 139-140 PHB, when the goblins retreat, Bjorn does not have the option to instantly follow. Instead he has to wait until his order in the initiative to use his move and attack action. Depending on the initiative order, the players could use these rules to rearrange their battle line by having one PC make a Fighting Disengage, and another PC stepping in his place to take up the battle from his teamates position.