I get why, say, the military is a public good, but I don't get why public roads are public goods, since they can't be non-rivalrous, given that at any time only a subset of the population can actually be on them.
The property of rivalry is a continuous (rather than binary) variable.*
A good is rivalrous if my consumption of it reduces the amount that can be consumed by others.
So, a particular Big Mac is fully rivalrous, because each bite I take from it reduces (by that exact same amount I've bitten) the amount left for you.
The degree to which roads are rivalrous is lower: My driving on a deserted road at night does not reduce at all the amount that can be driven on the same road by others.
But your doubt is correct—it is not generally $0$: My driving at peak hour at a city center does reduce the amount that can be driven by others.
Ideas are a good (and possibly sole) example of a good that's perfectly non-rivalrous. (My "consumption" of the Pythagorean Theorem leaves no less for anyone else.) Side point: But with the right laws and accompanying enforcement—e.g. patents, copyright—even ideas can be made excludable.
Defense is often given as a classic example of non-rivalry. But I would argue that although defense exhibits a very high degree of non-rivalry, it is less than perfectly non-rivalrous. (The resources used to defend John in New York from a nuclear attack does reduce the US Department of Defense's ability to defend Jane in Hawaii. The resources used to defend a nation with over 1B people are greater than the resources used to defend a nation with less than 1M people.)
*Likewise, the properties of excludability and being a public good are continuous (rather than binary) variables. (Many introductory textbooks tend not to emphasize this important point sufficiently.)
It depends actually a non-congested road can be considered non-rivalrous as when you drive there you don’t really reduce the enjoyment or marginal utility of other people driving them.
However, once the road is congested it becomes rivalrous.
Also note that even though many textbooks include public roads as public goods this is actually not technically correct. Technically since roads can be protected by toll booths they are excludable so it’s not correct to categorize them as public goods, they are actually a separate category of quasi-public goods - that is goods that have many characteristics of public goods but also some characteristics of private goods.
However, it’s very hard to find proper example of pure public goods (although army is a good example, non-polluted air another), so often undergraduate textbooks that are less nuanced than graduate textbooks include quasi-public goods that are very close to public good in same category.