In the world of patent law, you must follow a myriad of technical rules to secure a patent for your invention. One small misstep can cost you the ability to protect your product. Although it's not illegal to publicize an invention that isn't patented, doing so may cost you the ability to get a patent on the invention when you want one.
In the United States, your ability to patent an invention depends on whether you have made "public disclosure" of the work. The United States is more lenient than many other countries you this regard -- you may publicly disclose your work and still patent it, so long as you apply for a patent within one year of publication. A casual mention of the work does not amount to public disclosure. Public disclosure must be a written publication. Disclosing your work in a trade magazine or academic journal counts as public disclosure, and so does publication in the form of a slideshow given during a meeting, an advertisement, or even a poster at a trade show. Any written description of the invention that would enable someone to duplicate the work can qualify as a public disclosure. Yet in the United States, an offer for sale is a public disclosure, even if it does not completely describe the invention.
Timing is a key factor in whether publicizing your invention will prevent you from patenting it. The USPTO rules allow you to file a patent application within a year of publicizing your invention. This grace period is especially useful for inventors who don't think they want a patent but then change their minds. Some other jurisdictions, like the European Union, will bar patent applications immediately after the invention is publicized. However, if you've filed for a patent in the U.S. and then publicize your invention, you have a year to file patent applications in any other country you want.
It is not illegal to publicize someone else's invention before they've applied for a patent, whether you did so purposefully or accidentally. However, the USPTO's publication rules will still apply. Your publication will bar the inventor from patenting his product if he doesn't file a patent application within a year of the publication. There is one situation in which your publication could get you into legal trouble, and that is if you signed a nondisclosure agreement before the publication occurred. In that situation, publishing anything about the invention could put you on the receiving end of a lawsuit.
Some people want their inventions freely used by the public and never privately owned. In this situation, you may publicize information about the invention without ever intending to file for a patent, simply so that you can prevent anyone else from applying for a patent down the line. In order to successfully bar future patent applications, the publication must be so detailed that it would enable someone in the same field to build the invention.