Because of increased price transparency you can compare airfares and hotel rates much more easily than in the past, especially on metasearch engines like Kayak that search all over the Web airlines and hotels are desperate to build whatever customer loyalty they can. They think that if everything is equal, or at least close to it, you'll reserve with them.
So they reward loyalty not just by giving perks to repeat customers through frequent-user clubs but also by offering last-minute discounts via promotional codes, through e-mail newsletters and to friends and followers on social networks such as Facebook and Twitter. (Here's a list by Resideo.com of hotels using Twitter, organized geographically.) And in a related development, travel companies are already looking at ways to customize offers to you based on topics you've written about on Facebook, on Twitter and elsewhere.
The deals are last-minute because airlines and hotels want to avoid handing deals to the very folks who might have been most interested in booking anyway.