The router should be aware of the network and mask that it is attached to. So, it will shunt out packets towards the direction of the LAN that matches it, regardless of whether or not the host address exists.
Once it leaves the router's interface, it's no longer the router's concern.
If you have Packet Tracer, going into Simulation Mode, initiating a ping, and then watching the process span the network is truly interesting.