Taking a variable as given comes from the assumptions of the model and cannot result from any optimisation problem (think simply that when a variable is taken as given it is treated as a constant in your problem so one cannot lead to the other). Here, taking the public good as given means the household is not able to choose the level of public good to maximize their discounted lifetime utility, and instead this is taken as given (i.e. for a given level of public good I can simply choose my lifetime consumption and bond holdings path to maximize my utility). As for why this is assumed it really depends on the model you are looking at (the level of public good might be fixed (although note that in your problem there is a time subscript) or any individual might be to "small" to exert any influence on the level, etc.) but unless you are looking to endogenously determine the optimal amount of the public good the taken as given assumption is pretty standard.
As for the maximization problem, what is exactly your doubt? Have you tried setting up the Lagrangian and obtaining the FOCs to get the consumption Euler equation?