CTCP is the Client To Client Protocol. The purpose of CTCP is to send requests for information to other clients on the network, instead of the server. CTCP messages are specially coded and the client to which you send a CTCP request will respond if it supports the request.
You, the user, have complete control over the CTCP implementation. You may change how CTCP requests are handled, you may suppress certain CTCP requests, and you can create new CTCP commands for others' use. To find out what CTCP commands that your client understands, use /CTCP <your nickname> CLIENTINFO
You can send a CTCP message to any target you can msg, so it is transport-neutral.
You cannot send CTCP requests in an ON that was generated by a message from an irc server (such as ON MSG, ON PUBLIC, or ON NOTICE), because the IRC protocol does not permit it. You can send CTCP requests in an ON that was generated by a DCC CHAT connection.
Not all CTCP implementations are equal. Other clients will support mor or less requests than this client does. There is no way to guarantee that any CTCP request will succeed.
CTCP requests you send are hooked with ON SEND_CTCP, and the replies you get back are hooked with ON CTCP_REPLY. CTCP requests you receive are handled with ON CTCP_REQUEST, if you want to want to override the default behavior, and ON CTCP, if the default behavior is ok. The ctcp command sends a ctcp reply when you're inside these two latter ons.
To request the version of another client:
/ctcp version nickname
To ping a client that you have a DCC CHAT connection to:
/ctcp =nickname ping
To make a client echo back the the arguments you send it:
/ctcp nickname echo send this back