Let me try to address your question. You have to understand what each flag means first and you have to have basic knowledge of electronics as well as Boolean algebra (Boolean logic), and then you will be able to understand how they are "computed".
I suggest you start with Boolean algebra (Boolean logic) if you are not familiar with this subject.
If you are mainly interested in emulation, and how emulators compute EFLAGS, please start reading those excellent EFLAGS emulation ideas presented by Darek Mihocka from this article onwards.
Let me know if this helps.