All systems that use TCP/IP to talk to other systems consult a local "Fowarding Information Base" or local routing table which is maintained by the system.
A routing table entry basically looks like this:
Destination Network / Gateway / Destination Subnet Mask / Metric
Here's my current routing table:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 eth2
link-local 0.0.0.0 255.255.0.0 U 1000 0 0 eth2
172.16.160.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
192.168.2.0 0.0.0.0 255.255.255.0 U 100 0 0 eth2
192.168.87.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet1
Each time the system wants to send traffic out to an IP, it searches this table. If it finds a destination network that matches and fits within the subnet mask, it sends traffic out of the network adapter identified by Iface.
All of these network adapters are "directly connected" - so that's why you see 0.0.0.0 for gateway. This means if the system wants to send something to 192.168.2.80, for example, it can just send it directly to 192.168.2.80 via interface eth2.
However, because of the subnet mask, 192.168.87.80 would not go out through eth2, it would go out through vmnet1.
If an IP will fit in two entries, the one with the larger CIDR subnet mask (the "more specific one") is used. If there are two with the same subnet mask, the metric is used to break the tie, and if that's the time, the system may pick one and stick with it or load balance between them.
e.g.
192.168.2.0 0.0.0.0 255.255.255.0 U 100 0 0 eth2
192.168.2.0 0.0.0.0 255.255.255.240 U 100 0 0 ethX
255.255.255.240 is a CIDR /28, and 255.255.255.0 is a CIDR /24. So if the two entries existed, something going out to 192.168.2.1 would go out of interface ethX, but something going out to 192.168.2.241 would go out of interface eth2.
What if nothing matches? Then the default gateway is used. Notice it has the the "lowest" subnet mask of 0.0.0.0 (which is a slash /0).
So that's what the subnet is for. Telling the system which networks can be reached by which interface. Your system uses this when sending traffic out (to determine difference between Internet and local network) and routers use this to forward traffic.
Outside of those situations the subnet mask is not needed. It's not needed past the network routing layer, basically. HTTP is application layer.
1The effective subnet mask for an IP address outside your local network is always /32 (for IPV4; it's /128 for IPV6), so quoting it would be redundant – Mike Scott – 2017-10-04T10:51:36.583