With a legitimate birth, there is a presumption of legitimacy, and the birth can be registered without both parents necessarily being present. With an illegitimate birth, the father must be present and confirm paternity for his name to appear on the certificate. If that doesn’t happen, then the Registrar will put a line through the box for his name. Otherwise the mother might name someone else without their knowledge, which could lead to obvious difficulties later. Where the parents were not married the word “formerly” will normally have been deleted against the mother’s name (because in most cases she’ll still be using her maiden name). So you can look for that on the birth certificate.
In some illegitimate births I have seen, the mother used the father’s name as a middle name. So you get a clue to his identity that way. Doesn’t always happen though.
And as you have discovered, some baptism records will record the father of an illegitimate child, often with words like “reputed” against his name.