There are two main functions to the network layer: forwarding and routing.
Forwarding involves transfer of a (data) packet from an incoming link to an outgoing link within a single router.
Routing involves all of a network's routers, whose collective interactions via routing protocols determine the paths that packets take on their trips from source to destination. Broadcast and Multicast communications also fall under routing (it's a puzzle of finding proper route from source to destinations).
These are realized using three components:
IP Protocol responsible for forwarding and addressing in the Internet.
the Internet routing protocols responsible for the ways the routers communicate and coordinate.
Internet Control Message Protocol (ICMP) used by hosts and routers to communicate netwrok-layer information to each other.
Routers, and Internet Devices arranged in a Network of Networks (Internet).
On image above, individual networks are surrounded with ellipses. Red dots represent wireless routers/switches, red rectangles represent wirelessly connected internet devices. Green rectangles represent wired routers, light slate blue rectangles represent internet devices connected by wires. Lines represent connections.
Routers and packet switches are devices that transfer a (data) packet from input link (connection) to output link, according to the data in the (data) packet. That is, the (data) packets contain information about their destination, not only 'data' to carry to destination. Just like postal parcel consists of envelope with written address, not only cargo.
The difference between packet switches and routers is such that packet switches work for connecting two devices directly (they work on link layer, thus in one hop), while routers enable long-range communication, even if (data) packet has to go via many of such (they work on the Network Layer which allows two distant - with distance measured by number of hops - internet devices to communicate).
A protocol (in the Networking context) defines the format and the order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or receipt of a message or other event.
See also: Internet seen by technical eyes (for computer enthusiasts), Unicast, Broadcast and Multicast routing, What is router and how it can work.