Let’s adjust the question slightly first. Let’s talk about devices when we are discussing technical aspects. Each user can have up to five devices (yes: laptop, tablet, work phone, personal phone, watch, weather station, internet radio…)
What are the user expectations or requirements?
It is a completely different matter to serve 40 IoT devices that occasionally transmit sensor data than to serve 40 user devices displaying separate 4K video streams each. VoIP calls like Skype won’t transfer that much data, but they are very sensitive to delays (called latency) and fluctuation in the delay (called jitter). So you first need to find out what kind of applications the users have in mind. The problem is that this is a moving target. Each time you improve the network the users will find uses for the new capacity. That means the expectations and requirements will be totally different next year.
Limited air time
Wi-Fi is a shared media, which means the devices compete for air time. While one device is transmitting the others are receiving or at least wait in silence. (802.11ac introduced MU-MIMO which allows concurrent transmission for a few devices at a time, but this hasn’t changed the situation significiantly.) The net result is that as the number of devices grows so does the queue of devices waiting for a turn to transmit, which will increase latency and jitter.
The more data is transferred the higher is the utilization, which increases the wait times as well, since the turns are longer.
Think of it as a negotiation table. As the number of negotiators increases the longer it takes for each get a turn to speak. If the speeches are long it will take even longer to get a new turn. In Wi-Fi there is no chairman to give turns in order, but the process is somewhat random.
The cell size
The more area an access point covers the more different will be the quality of the client connections. Some devices will be closer to the AP while some will be at the edge. The devices on the edge will use hundreds of times more time (the minimum rate is 1Mbps) to transmit the same amount of data as the devices close to the AP (at 300/450/600Mbps).
In theory transmitting one megabyte at 1Mbps takes 8 seconds or 8000ms while it takes just 13ms at 600Mbps. In practice you should double those figures to account for the overheads and acknowledgments but still the ratio is 1:600.
So what IS the answer?
Some vendors will give you a figure: 50, 100 or 255 devices. The last one probably just means how many devices the AP can hold in memory at one time. 255 devices competing for air time is an impossible scenario, unless we are talking about the IoT devices sending sensory data once a minute. The 50–100 devices per AP is the well known case when a hotel advertises “We have FREE Wi-Fi!” Yes, they do, but it is useless.
According to 802.11 the theoretical limit is 2007. Most chipsets will set the bar lower: 100, 128, 255 or some other number. There is no point in comparing the figures. They don’t tell anything about the power or quality of the AP.
One access point can support a high number of clients, if the devices are near by. This is the case for HD or High Density access points some vendors offer. They have a little more memory and a better processor, but the main difference is in the antenna design. The antennas are designed for short range. If all the devices are within the same conference room they can all be connected at 300Mbps at least. The air time can be split into very short slots so everyone gets a share and still have useful bandwidth. These APs are designed to prevent connections from outside the room because those would be slower. You can place multiple HD APs in a large auditorium if necessary since the coverage is designed to be small, at least if you set the transmit power down.
You can use a couple of dozen of devices per access point as a rule of thumb. If you are designing for a high capacity network, use more APs and smaller cells. There will be less devices in each cell and each one will have a better connection. Both will improve the capacity of the network on its own and together they complement each other. It is a win-win and the cost of modern APs makes this affordable.
If you need more accurate estimates I recommend the Excel models by Andrew von Nagy.