I do not understand how people construct a suitable action which after variation will give the correct equation of motion. For example, the Einstein Hilbert action: S=integration[R d^4x] gives the equation of motion when varied with respect to [g_mu nu]. But no book I had read so far tells me how to construct this action. Can anybody help me with this? Second, if someone says that the action is constructed so that after variation it must give the equation of motion then why do I need to use this technique in the first place where first I have to know the equation of motion and then construct the action, then vary it and rederive the equation of motion which I already had? Third, how do I know that an action is the only action which will give the correct equation of motion?