An invention is anything that has some degree of novelty. It can be a thing (such as a trigger mechanism), a process (such as a process for treating water), or even a technique (way to extract compounds from a mushroom, or a way of treating metal to increase its strength).
For something to be considered an invention, it must contain an element of novelty. This means there must be something substantial that has not been done before (prior art), or there must be some knowledge that is new to humanity. Some inventions are groundbreaking, such as a way to deliver drug molecules past the blood-brain barrier. Others may be less dramatic; for example a way to clean cars using an industrial pressure cleaning system combined with a new detergent to prevent damage to car paint. That this is considered an invention is often a surprise to new inventors. Many people are not aware that new uses of known techniques applied to obtain a new effect is also considered an invention!
Another category of inventions are design inventions. For example, a new way of folding a laptop keyboard, or a design for an orange peeler.
However, some things are in general, not considered inventions for patent purposes. Discoveries of laws of nature are generally not considered inventions.For example, you generally cannot patent a mathematical equation, because it is considered merely a discovery of a mathematical truth. However, you should be aware that there is no global consensus on what is considered a patentable invention and what is not.
For example, for a long time, software was thought to be unpatentable, because of its mathematical nature. However, this was later found to be untrue as software increasingly became accepted as patentable matter in the United States.
There is some controversy today about whether things like business methods, genes and artificially engineered DNA sequences can be considered inventions. Many companies have simply taken a "patent first, worry about it later" approach while the legal community works things out. If you are working on an invention in these areas, it may be worthwhile to consult a patent attorney to understand the legal situation. The important thing is to be aware that there is no universal consensus, and what may be patentable in the United States for example, may not be patentable in other countries and vice versa. There is an excellent Wikipedia entry on patentable subject matter (external site) that provides more details.