It all depends on succession laws. In agnatic or Salic succession; only males can inherit. So the crown would pass to the Kings brother or closet male relative. In semi-Salic law if there are no males to succeed the closet female relative will inherit the crown (the Kings daughters).
The bastard will remain a bastard and unable to inherit the crown. Although in some circumstances a bastard may be legitimized (accepted as a legitimate heir) allowing them to inherit the crown.