Creative ideas come from our minds, and inventions are the physical manifestation of those ideas. The part of intellectual property law that covers inventions are patents.
Patents are granted by a national government office (i.e. USPTO) after reviewing an inventor's application for patent, an application that describes your new machine or process and what it can do.
Three Basic Types of Patents
Utility patents protect useful processes, machines, articles of manufacture, and compositions of matter, or improvements to any of the above. Examples: fiber optics, computer hardware, medications.
Design patents guard the unauthorized use of new, original, and ornamental designs for articles of manufacture. The look of an athletic shoe, a bicycle helmet, and the Star Wars characters are all protected by design patents.
Plant patents are the way we protect invented or discovered, asexually reproduced plant varieties. Hybrid tea roses, Silver Queen corn, Better Boy tomatoes are all types of plant patents.
You can file for both a utility and a design patent for the different aspects of the same invention.
Do Not Patent
Laws of nature (wind, gravity)
Physical phenomena (sand, water)
Abstract ideas (mathematics, a philosophy)
Literary, dramatic, musical, and artistic works. These can be copyright protected.
The USPTO will not patent perpetual motion machines as they are considered impossible.
The USPTO excludes the patenting of things useful solely in the utilization of special nuclear material or atomic energy for atomic weapons. Also anything designed for an illegal activity.
You Can Only Patent
Inventions that are:
Novel or New
Nonobvious - This means an invention must be sufficiently different. For example, the substitution of one material for another, or changes in size, are ordinarily not patentable. So even if the invention you seek to patent has not exactly been made before, if the differences between it and the next similar thing already known are too obvious (too close to being the same) your patent will be refused.
Inventions which are useful. Your gadget must do something and serve some practical purpose. And it must be able to perform its declared purpose.
More about the above points next and how to determine if your idea is patentable.