How does Beatrice remember about Subaru?
Because the "save point" for that part of the story is not the point when Subaru wakes up for the first time, but when he wakes up for the third time. That's also when he first meets Ram and Rem. (His first waking is before the opening in episode 4, while his third is right after the opening.*)

*At the start of episode four 


   Subaru wakes up, notes that it's an unfamiliar ceiling, walks around a bit, finds the library, talks with Beatrice then falls unconcious because Beatrice suck some of his mana.