If Santorum would've dropped out one day earlier he would've been removed from the Pennsylvania ballot. Once they drop out I believe they generally are removed from upcoming ballots if there's enough time.
They rarely drop out, they just suspend the campaign (mostly so they can continue to fund raise and pay off debt). I am not sure how they get removed from the ballot for just saying they are suspending the campaign. They've paid the fees to get on the ballot after all. I'm not an expert on state election law though.