Your router knows the prefix length because you configure it. Whenever an interface is configured with an address, whether on a host or on a router, the prefix length (or the equivalent netmask) is entered alongside it.
It's functionally the same as IPv4 configuration for your Windows PC at home – the PC knows it's 192.168.1.x/24 because it has "Netmask: 255.255.255.0" filled in; the router knows it's .123.1/25 because you (or the ISP) had to specify the "/25" when doing ip addr add
.
Distant routers either a) do not care or b) will learn a route towards your /25 as you advertise it via BGP to your upstream ISPs, and the same BGP advertisement includes the route prefix length together with the network address. All routing protocols in use today have been extended to carry the prefix length – that's the whole point of the "CIDR" effort.
Note however that distant routers only care about the route prefix, at most. They do not care about your subnet size – the BGP advertisement may cover multiple of your subnets (an aggregate route), or it may cover half a subnet, none of it makes any difference for the packet delivery.
Things like "reserved for broadcast" addresses do not enter into play here, so packets to ".0" and ".255" addresses will just be forwarded without any special treatment (the destination might not even be a broadcast-capable subnet at all; it might be a /31 or /32 PtP link where any address is valid).
(The decoupling of routes and subnets happened even before CIDR – it's literally why the "subnet mask" is called a sub-net mask; it used to be that BGP continued carrying only classful routes for quite a while even as the operators already had their classful networks internally subdivided into classless subnets.)
This means a host or a basic CPE router can just have a single 0.0.0.0/0 route (the "default" route) and will absolutely not care about whether some distant network is /25 or something else.
In most cases, ISPs will only advertise aggregate routes via BGP and not individual subnet routes – it's generally frowned upon to do otherwise, as the global BGP tables are already large. (In fact, you're not even allowed to advertise an IPv4 /25 on the public Internet; ISPs only accept advertisements for /24 or larger, or similarly /48 for IPv6.)
In other words, there's no "Network prefix" field in IP headers because the only device that needs to know it – the final router at your site – already has that information configured explicitly.
222.123.123.0/25
may well be one of the countless routes in the BGP tables somewhere222.123.123.4
's network prefix is /25