UE get to know this during initial process, UE get to know that during PSS and SSS process.The possition, where PSS & SSS signals are transmitted, is different for FDD and TDD mode. In FDD mode, the PSS is transmitted in the last symbol of slots 0 and 10, while the SSS is sent one symbol earlier.
In TDD mode, the PSS is transmitted in the third symbol of slots 2 and 12, while the SSS is sent three symbols earlier. thus if SSS and PSS are adjacent to each other then it is FDD and if there is two more more symbols between SSS and PSS then it is TDD