A network device generally has 3-4 queues for traffic handling. WFQ is not strictly speaking a queuing algorithm, it's a egress traffic scheduling algorithm. It determines how the traffic placed in different queues is sent out of the device. The way fair queuing works is that traffic placed on different queues is served in order, for example in case of three queues they would be served 1-2-3-1-2-3 and so on. We can give double weight for queue 1, in which case the queues would be served 1-1-2-3-1-1-2-3.
"Classifying arrivals" refers to the way ingress packets are handled within the device itself. Generally network devices uphold the existing priority of the traffic, placing incoming packets to appropriate egress queue based on what priority it has. However in every case the device actually looks into the frame itself, either the L2 or L3 header.
Ingress frames can be prioritized several different ways. We can use the ingress interface, or determine it by Layer 2 frame information such as 802.1p/Q priority (Class of Service, CoS), L2 MAC address or VLAN ID. This is how a L2 device such as a switch works. For example the packet may arrive in a specific "Voice" VLAN (used for VOIP traffic), in which case it will be placed in high priority egress queue. Or the frame header's 802.1Q VLAN Tag may contain a 3-bit PCP (Priority Code Point) field which determines which queue the packet is placed in.
A router as L3 device would look at the IP packet header in the frame payload. There's a wide range of ways to prioritize the traffic, from the incoming interface to the IP address, subnet, TCP/IP port number and so on. Most commonly used is probably DiffServ (Differentiated Services). This uses 6-bit Differentiated Services Code Point (DSCP) in 8-bit DS field in the packet header. This allows much more granulated priority categorization, in theory 64 (2^6) different priority levels. In practice however most networks use commonly defined per-hop behaviors:
- Default PHB - typically best-effort traffic, used for normal PC data
- Expedited Forwarding (EF PHB) - used for low-loss,
low-latency traffic, for example VOIP
- Assured Forwading (AF PHB) - ensures delivery under certain pre-defined conditions
- Class Selector PHB - maintains backward compatibility with previously used ToS (Type of Service) field in IPv4 header
More in-depth descriptions how traffic priorization works can be found for example in Wikipedia. Type of Service, Class of Service, Quality of Service, 802.1p and 802.1Q are good starting points.