The most obvious sign is the LEGO mark present on each stud. I have yet to learn of any single copycat company that would go through the legal and technical trouble required to mold these onto every stud of every piece in a consistent fashion.
If the piece has no studs to check or the markings are present and you still have doubts you can take a suitably strong light and magnifying lens and look for a trademark or a 4-5 digit part ID. This on the right side is a very obviously visible example, others might be much smaller and better hidden. A missing ID would obviously indicate a fake piece. But even if it is present you can cross-check the existing LEGO piece databases to see if the part ID does indeed represent the part you have.
Should a bootleg company go to the lengths to correctly add all such markings, you can still take a known genuine part of the same design and check for any differences in dimensions. LEGO has notoriously tight tolerances when it comes to precise size. You can check the material as well, fakes could have different weight, sheen, flexibility, clutch power or could feel different to the touch.
And in the unthinkable case when a competitor manages to get all markings, dimension and material properties right, can evade all inherent lawsuits and their prices are not egregiously high then they maybe deserve to be used as "real" LEGO pieces :)
But only then ;)
Sidenote: Old LEGO jewels (diamonds) dont have any ID or trademark on them, the newer ones do have both though.