Used in Layer 2, an ARP’s goal is to find the MAC address of a host, given the IP address. If the sender knows the host is on the same subnet, it’ll send the ARP request, once it receives a response, it’ll have that host’s MAC address. At this point the two hosts can communicate directly without a router.
Routers will ARP when forwarding data from another network. It needs the MAC address of the destination in order to send out a Layer 2 frame. It’ll ask “Who has 126.96.36.199?”
OS and router cache ARP requests so they don’t have to be sent for every single packet. They store all ARP broadcasts that have been seen so that they don’t even have to be seen on the first request. A RARP is the opposite where the hosts ask “Who am I?” It’s an alternative to DHCP and is mainly used when a new machine boots up and needs an IP.
Proxy ARP is when a host gives a false ARP response, usually for a host that can’t send ARP requests. Routers normally proxy ARP for addresses outside the subnet range. Gratuitous ARP is an ARP for itself. It is used to update changes in IP or detecting other hosts with the same IP address. Promiscuous ARP can change the IP/MAC mappings.