5 Answers
5

In the original timeline, when the movie starts and Doc tells Marty to meet him at the mall, he doesn't yet know if the experiment will work. Time travel in Back to the Future works by changing history, and at that point, no one had time traveled yet.

In the new timeline, shown at the end of the movie, it's unknown whether all of the 1985 events from the beginning of the movie still happen--Marty might have driven to school rather than hitching rides, for example--but we do know that Marty meets Doc at the mall, the time travel experiment still happens, and the Libyans still show up. We also know that Doc had the letter (and the vest) in this timeline, though, where he didn't before.

As a result, it's unknown whether Doc in this timeline did the experiment because he knew he "had" to, or just to see if it would work like in the original timeline, or some combination of factors, but he does seem unsurprised to see Marty when he reappears back at the mall.

I think that, in the beginning of the film, Doc really doesn't have the letter. Marty's actions in the past changed our present, which is visible by the changes in the characters of Marty's family members and Biff, by the "pines" sign, etc.

This very question was asked and answered (by BTTF writer, Bob Gale) on the film's official FAQ

Doc Brown of 1955 learns a lot about the future from Marty. Shouldn't the Doc of 1985 remember all of those things that happened
in 1955?

A:3 possible answers, all credible. 1) The "Ripple Effect" of time travel (which caused all of the photographs to change) does not
affect human memory. 2) The 1955 Doc suffered a memory loss sometime
after his adventures with Marty (maybe it was from the drugs he took
in the 60's as Reverend Jim!). 3) Doc actually did remember
everything, but he still did all the same things he "remembered"
because he didn't want to risk disrupting the space-time continuum.

There's a 4th possibility which depends on your view of time travel.
There's a theory (we like to call it the "Self-Preservation Instinct
of the Space-Time Continuum Theory") that says that the continuum is
always trying to keep itself "on course," and when things happen to
change it, it always tries to correct itself. It is much like a river,
which tries to keep its overall course. Although earthquakes, fallen
trees, floods, or other circumstances might disrupt it at points, the
river would cut a new channel so that it would end up back at the same
place.

Thus, the overall physics (or metaphysics) of the space-time continuum would insure that any of Doc's memories of events that might
create paradoxes would become hazy — or be erased.

To put it another way, he may well have always had the letter (hence the bulletproof vest), but his memory of the events that took place in 1955 would have only become clear as he got closer to the point that Marty traveled back in time.

I’ve seen BTTF1 hundreds of times since I was a child. What I’ve always believed is that when the events at the mall first happened at the beginning of the movie, the Doc did actually get shot. I always felt that at that point he built the time machine based on science and instinct. Meaning that he wasn’t friends with Marty and hiding the fact that he had already met him the whole time. I think the original events were genuine the way it seemed. But once Marty came back at the end, as he was watching at a distance, the events seemed the exact way they already happened. But in that alternate timeline the events had changed. Therefore in that timeline Doc was friends with Marty but hid the fact that he had already met him because he was scared of disrupting the time continuum. I believe he waited until the time Marty told him to read the letter even though he knew reading it could disrupt the continuum. To summarize my point... I don’t think that in the original timeline in the beginning of the movie, that Doc was lying the whole time about knowing Marty and knowing how the events of that night with the Lybians would play out. But after the timeline changed, and Marry came back to the future, Doc did hide the fact that he remembered Marty. Which him remembering Marty is why he untimely read the letter even though it was against what he believed. Doc knew Marty would write a letter jeopardizing the continuum unless it was absolutely necessary

I think Doc already knew. 2 things back this up in the movie itself - 1, at the beginning of the movie, we see a bunch of clocks - one of the clocks, show a man that looks like Doc hanging off a clock hand on a clock tower, much like Doc does later in the movie. Coincidence? Maybe. I mean, Doc would of had to construct that himself, right? Which brings me to point 2, when Doc and Marty tested their lightning bolt idea. Doc had an exact scale model replica of Town Hall with the streets and buildings surrounding it, which indicated that Doc was a talented sculptor, which means he very well was capable of making that clock in the beginning of the movie. So, I think he knew all along and just kept it to himself to not mess up time. Also, keep in mind, although we see Doc shot and laying on the ground when Marty travels back in time, we don't necessarily know for sure he died. He lays that way, and doesn't reveal he's still alive until after Marty #1 travels back in time and Marty #2 shows up and starts to mourn him. He could have been alive the whole time.