How and/or when does Lex Luthor find out Superman’s identity? From my
point of view, it is not really obvious in the movie.
When: After the Black Zero Event (the attack in Metropolis) and before the discovery of a large chunk of Kryptonite in the Indian Ocean.
How: After the Black Zero Event, Lex has an existential crisis (tech billionaires are far from immune from these, Elon Musk has them towards everything from virtual reality, to artificial intelligence, to extraterrestrial life; mitigated only by the fact that none of these exist on a level to crack him yet). In his comparative and relative powerlessness (neither he nor Bruce are powerless, but they feel relatively powerless compared to an alien capable of state-level interventions and destruction), Lex clings to the only power he can accumulate: knowledge.
Lex says this explicitly during the fundraiser speech.
The files recovered by Bruce and Diana aren't just plugs for the Justice League but key insight into Lex's motives and knowledge. He combed through illegally acquired data with facial recognition algorithms allowing him to catch Wonder Woman in present day. That same mountain of data and software would fairly easily see through Superman's disguise or Batman's background. By the time the story starts in earnest, Lex has already uncovered everything about everyone.
The fact that there is no file on Batman or Superman (yet a file on Kryptonite!) in the files stolen is a huge hint.
In fact, Lex offers Bruce access to his R&D, essentially opening an alternative legitimate avenue to the same materials Bruce stole. Lex WANTS Bruce to have those files.
In some sense, this is the "what if" from the 1980s Man of Steel run where Lex decides to actually LISTEN to what his computer revealed about Superman's secret identity, rather than ignore it as impossible due to his own hubris and projections of who Superman would be, layered with an existential crisis.