What is the maximum number of personal computers that should be put on a single subnet? What is the maximum number of personal computers that can be connected to a switch?
As Jon notes, /24 (254 hosts) is often the common max. One reason for this, it also corresponded to classful addressing using a class "C" address. (I.e. the way grandpa did it.)
Classless addressing, which makes it easier to size your network subnets however you desire, brings with it, as Jon also notes, this common question.
Often people wonder, why can't we just have one huge subnet, or any number of hosts.
In theory, we could place every host in the world on one network segment (Ethernet MACs handle it), in practice there are reasons why this doesn't work. Jon also touched on a recent one, containment of host infections and/or implementation of subnet-to-subnet security. However, one ongoing issue has been scalability limited by sharing a common physical medium.
Originally, all Ethernet hosts shared the same wire. They see all traffic. If all hosts send/receive very little traffic, quite a few can share the wire. As each becomes busier, not only is there less bandwidth to share, but they also bump into each other trying to obtain it. The solution was reduce the number of hosts per wire. Since even one pair of hosts could saturate a wire, the ideal solution was to only have one host per wire. We call this Ethernet switching.
With it, one might assume we can now have all hosts on a shared subnet, but we have the problem of broadcasts. Broadcasts are intended to be visible to all hosts, although most hosts don't do anything with the information seen. It does, though, still make for a scalability issue.
To make things even more complex, the level of "normal" broadcast traffic often varies based on the type of hosts. For instance, Windows hosts, using Netbios/NetBEUI, used to be very broadcast chatty, so you often found the need to limit their number on a shared segment more so then pure IP hosts.
With all the forgoing, surprisingly, the original class "C" subnet or /24 works well in most cases. However, sometimes you can segment larger, or need to segment smaller, depending on what your hosts are doing.
The general practice is to use one subnet per vlan. When you have separate vlans you need routed interfaces to route traffic between them. It is much easier to control traffic going from one vlan to another with a L3 access-list.
Also many virus rely on broadcasting and broadcasts do not by default go between vlans but a broadcast will be sent to all machines within the same vlan.