How does it work?
An IRC network consists of a collection of servers, with each one providing a point of which clients can connect to (to talk to each other), and a point for additional servers to connect to.
An IRC client reads and parses any commands given to it, and then performs a particular action depending on what was entered. Such as passing on a message to a server. An IRC server can serve many clients, holding information about the channels and the people which are using these channels.
The servers are responsible for routing the messages to other people on IRC. The IRC network consistes of multiple servers which are connected in a 'tree'-like network (known as an undirected acyclic graph).
When a client sends a message to an IRC server, the server broadcasts that message out to all the other clients connected to the same channel, and onwards to other servers which do the the exact same.