The following is an oversimplified explanation, applicable in the most general of terms, to the US federal system.
There are two kinds of confidential informants; documented and undocumented.
A documented informant is tied to a highly classified paper trail (true identity, background/criminal history, contact info, record of past performance, etc.). This permits payment(s) of government funds, usually converted into cash, in exchange for cooperation and/or information. Since records exist, there is always the possibility that the veil of secrecy may be compromised. In some cases, a court with the appropriate authority may order disclosure.
Undocumented confidential informants have so such paper trail. The investigator who maintains such a relationship keeps all information to himself/herself. Government funds typically cannot be accessed for payment(s). Compensation/consideration is the investigator's problem. Secrecy is at the investigator's discretion.
Agencies generally discourage the habitual use of undocumented confidential informants. The lack of documentation inhibits the use of information provided from such sources in affidavits for court orders (search warrants, arrest warrants, etc.). A court with the appropriate authority may order disclosure; investigators who refuse to comply may find themselves held in contempt of court.
Pragmatically speaking, good investigators use both types of confidential informants. Every bit of information provided must be corroborated or refuted. The judicious use of such resources in the overall strategy of an investigation is considered the hallmark of a seasoned and savvy criminal investigator.