The role of NADH and FADH2 is to donate electrons to the electron transport chain. They both donate electrons by providing an hydrogen molecule to the oxygen molecule to create water during the electron transport chain. NADH is a product of both the glycolysis and Kreb cycles. FADH2 is only produced in Krebs cycle. Hydrogen molecules are necessary to the synthesis of ATP. ATP synthase molecules uses hydrogen molecules to create ATP from ADP. The process of creating ATP from ADP is called "oxidative phosphorlyation".
During the electron transport chain, NADH become NAD+ and the H get transported across the membrane. As a result, electrons reduced from NAD+ are used in the transport chain. Similar thing happens to FADH2 as well. FADH2 becomes FAD+ and the H's are transported across the membrane. These hydrogens that were released by NAD+ and FAD+ are used by ATP synthase enzyme to make ATP by pulling hydrogen molecules back across the membrane.