Does the router have to always take the first valid host addresses in a subnet?

Solution 1:

The router/gateway does not need to be the first valid address in a subnet, no. But it has to use something and by convention its the first (or occasionally the last) available IP address in the range. After all, why make things more difficult than they have to be?

Solution 2:

As Robert stated in his answer, the router can be assigned any valid ip address in the subnet but the convention has been to use the first, or occasionally, the last valid ip address.