If a wireless network has collision avoidance, how comes the network slows down if more clients connect to it?
A wireless network is only a single, shared medium with a limited total bandwidth. The more clients compete for bandwidth the smaller each slice gets.
Additionally, the simple presence of clients consumes bandwidth = air time. It's not much per client but it sums up.
Also, more clients also mean more potential senders, so that collisions become more likely. They're generally tried to be avoided but that can't be accomplished 100%. Each collision means wasted bandwidth for the partial transmission, the jam time (so that everybody hears the collision) and the random retransmission pause (to avoid the next collision).
Finally, spreading a number of wireless nodes over a larger area makes the hidden station problem more apparent where a potential sender can't hear that another sender is already transmitting, making a collision hard to avoid.
If a wireless network has collision detection and avoidance, how comes the network slows down if more clients connect to it?
To begin with I wanted to note that 802.11 makes use of collision avoidance, but not detection. These are two entirely different processes.
As for why an 802.11 network slows down if there are more clients, there are two primary reasons.
First, there is an increase in the amount of management traffic when you have more clients. One example is that each client will be sending out periodic probe requests which take up air time and may cause the AP to respond with a probe response (also taking up air time). Clients do this to determine if they should roam to a different AP on the same network or to a different network based on changing conditions.
Another example is that many clients will send frames informing the network that they are "sleeping" or entering a power save mode. This lets the AP know to hold onto frames for the client until a designated time when the client will wake up to check for traffic. While this may seem a bit wasteful, it is actually more efficient in general as it prevents the AP from sending and resending a frame for a sleeping client. However, either way, some air time is used.
Second, as others have also pointed out, there are simply more collisions. CA does provide a framework of rules to help avoid collisions, but they can still occur (afterall, it isn't collision elimination, right?). There are a number of factors here, but one of the biggest is the more clients on the network, the greater the chance of having a hidden node issue (or more than one). This is when you have two clients that are typically (but not always) on opposite sides of an AP's coverage zone, such that they can hear the AP but not the other client.
Since someone else brought up the traffic analogy, there are rules of the road which help with collision avoidance (i.e. stay in your lane, use of turn signals, etc). Generally speaking even when everyone follows the rules, accidents still happen at times. However, the chances of an accident are far less when yours is the only car on the road than when the road is packed with hundreds of cars.
Straight from Wikipedia:
Collision Avoidance: if another node was heard, we wait for a period of time (usually random) for the node to stop transmitting before listening again for a free communications channel.