So did Hashem know that Adam and Eve would sin? If yes how come he made that happen in the first place? Is it considered hashgacha pratit and was it suppose to happen? If yes how come?
There is a slightly different spin from Rabbi Kaii's answer that I saw in the book "Where's My Miracle" by R. Morey Schwartz, p. 119-125, which is really close in spirit to Midrash Tanchuma Vayeshev 4.
G-d created humankind in His image by giving Adam and Eve the freedom to make their own personal choices. I.e. they were not compelled to make an action (eat, drink, procreate, etc.) based on instinct, but through a freedom of their personal sophisticated choices, unlike all other creatures. Humankind, however from the outset was not satisfied with their blessing of choice. As they sought to choose between better over good, G-d wanted that they obtain capacity to reason, to weigh pros and cons of a situation, and then expand their choices to include capacity of choosing bad over good, and willing to suffer potential consequences of such a decision.
The snake nachash, which excited Eve, represented the capacity to use one's own intelligence to discern right from wrong, good from evil. (Similarly to how Yosef stated regarding the goblet nachesh yenachesh (Bereshis 44:15) and Rashi there explains used my own intelligence and logical deduction.) Thus, the Tree of Knowledge was not necessarily a test, but rather means through which G-d enabled the first humans beings explore their capacity for judgement. It taught them that when they use their G-d like priviledge of reason and discernment, they by nature of their humanity will sometimes choose erroneously, and will at times perforce suffer the consequences.
Also how was life before in Gan Eden? Was it only spiritual and not physical, e.g. the whole world was all like a fire that is in a potential way, i.e. hidden inside a coal?
I agree that this is a separate question, one of the possible references is Sanhedrin 59b.