Hackathons are a great way for companies to find new ideas around their product and test it in different situations and contexts.
These events are a mashup of tecnologies and products, mixed together in a very short time: a situation not easy to reproduce differently and for a lot of companies not economically possible.

When the product is an API or a libraries, an hackathon is pure gold; they are a good investment with tiny effort, that helps companies to make blackbox testing and be able to validate: documentation, libraries, api and discovers problems of their product.
During an hackathons for 24-48 hours, hundreds of developers are testing company's product/api/libraries for "free".

It is not always a win for a company, some projects/products are just ignored by developers during an hackathons but at least a good way to promote a product.

Btw, there are a tons of good reasons also for developers to be part of an hackathon:
- Test your skills: during an hackathon you will need to put your best knowledge, trying to build a working prototype in a very short time. Every problems will keep you far from your objectives, forcing you to reduce the features you want. It's challenging.
- Networking:find people to create a collaboration (designers for example), talking with people of other places and discovering their way of thinking, that is culturally different and then, it is interesting.
- Prices: good prototype, good pitch, good idea and a bit of luck, with those ingredients it is possible to win cool prices.
- Validate your ideas: do you think to have a good idea to show? don't you want to measure how good is it? It's the perfect situation: you validate ideas against strangers, not only friends.
- Learn new tecnologies from others of your team or improve your knowledge: I've tested ionicframework during an H this year, just to see how usable is, in a real situation (= not ready enough)
- Feeling home talk with other developers about geek's things: new products, libraries, technologies and ideas.
- Find a new job Never gone to an H for this, but it happens that some companies are there to seek new employes. They'll come to you asking for an interview: "what are you doing in your life? What's your job? Why don't you come and visit our companies?" and so on.
- Pitching speaking in front of a lot of people and explaining your idea. You need to summarize, make choices, be clear and convince others of your work in a short time. Plus: do it in a foreign language.
- Enjoy the experience: it is a devastating phisically experience but you will be happy at the end anyway

And remember to be prepared before the hackathon:
- read how many documentation you can, about the aim of the hackathon and the sponsors (also searching on stackoverflow problems with api/libraries)
- write down some ideas you will like to build there and be prepared to join others idea
- choose a platform/tecnologies that you will use during the H
- prepare your hardware: tablet,smartphones, smartwatch ...
- prepare your software: libraries, framework, examples, documentation

So if you are now convinced and you want to keep an eye on hackathons near you, check www.challengepost.com