Why Does the Letter ‘S’ Look Like an ‘F’ in Old Manuscripts?

Where did the long s come from and why has this character largely disappeared?

Source: https://www.livescience.com/65560-long-s-old-texts.html