Ships which have a cloaking device built in can cloak by setting their mission to cloak. Cloaked ships are invisible to enemy ships and planets. They can not be attacked as long as they are cloaked.
To cloak, ships will burn an amount of fuel that is equivalent to their hull mass. The minimum amount of fuel used to cloak is 5kt Neutronium. Cloak can not fail in the .NU standard configuration, however you need to have enoght fuel to cloak and 1% damage will prevent you to cloak your ship.
Some ships have advanced cloaking devices, those do not burn fuel to cloak.