Depends on the person and how close the friendship.
Its happened a few times with people who have been friendly aqquintances (people i talk to but I don't consider actual friends) but they always tell me years later (mainly cause Im usually in a relationship at the time so they wouldn't confess to me then and I'm kinda intimidating apparently lol)
It has happened with two of my closest friends who I've known for 16+ years.
One didnt tell me until years later when he was over it he even showed me the poem he had written about me (I still have it on my hard drive) I was somewhat oblivious as I am usually so like its not something I noticed back then, in hindsight it makes alot of sense lol
The other confessed probably 6 years into our friendship at that point we had been through so much together, he was struggling with his cheating ex who cheated on him with my ex and his friends (it was messy)...i was the only real constant honest person he had in his life at the time. We basically talked it through from why we didn't get together in the first place (we actually met each other first, him and my ex were friends at the time but we always had this instant connection but I didn't persue it cause he was dating the girl who would fuck up his life 4 years later...)
to why it wouldn't work now, and if he was really in love with me (he was... Not really anymore at least I would hope not lol). We had been close friends for way too long at this point and I'm not a hopeless romantic type so wed clash heavily but as friends we are solid.
We talked about him having space away from me if he needed, he was okay though, weirdly he was one that brought me and my current partner/last ex together, who since then we've had a child and are still pretty much in love with each other after 14 years... But I'm just weird cause I don't want to be in a relationship so it's complicated, I just like being alone lol