A router on a stick, is simply a router using 1 physical interface, but 2 logical interfaces to route between 2 vlans.
Lets say that VLAN2 and VLAN3 (the broadcast domains) exist on the switch, and the router's Fa0/0 is connected to switchport Fa0/1.
The switch trunks to the router on that port, sending the traffic for both VLANs, tagged via the trunking protocol.
On the router side, the IOS creates 2 sub interfaces, (fa0/0.100 and fa0/0.200 as an example) with 1 of them paying attention to frames tagged for vlan 2, and the other sub interface paying attention to the tags for vlan 3. Each sub interface has one IP address, that matches the other devices that may live in that same vlan (2 or 3). The devices in each point to the IP address of the router (in their vlan) as a default gateway.
Router example, for fa0/0
encapsulation dot1q 2
ip address 10.20.11.1 255.255.255.0interface FastEthernet0/0.200Switch connected to that router port example:
encapsulation dot1q 3
ip address 10.30.11.1 255.255.255.03560(config)#int FastEthernet 0/13560(config-if)#switchport mode trunk3560(config-if)#switchport trunk encapsulation dot1q
The term, router on a stick, refers to the physical layout, of the Router, with a single connection to the switch.