Q1) Let consider the problem : $\Omega \subset \mathbb R^n$ open, bounded and smooth, $f\in L^1(\Omega )$, $g\in H^{-1/2}(\partial \Omega )$
$$\begin{cases}-\Delta u+u=f&\Omega \\ \partial _\nu u+u=g&\partial \Omega \end{cases}.$$
I have no problem to apply Lax-Milgram, but in which functional space do I have to solve the problem ? I mean, the weak equation $$\int_\Omega \nabla \varphi\cdot \nabla u+\int_\Omega u\varphi+\int_{\partial \Omega }u\varphi=\int_\Omega f\varphi+\int_{\partial \Omega }g\varphi,$$ but where do I take $\varphi$ ? in $H^1_0(\Omega )$ ? In $H^1(\Omega )$ ? Is there any compatibility condition ?
Q2) What is the weak formulation of the problem $$\begin{cases}-\Delta u=f&\Omega \\ u=g&\partial \Omega \end{cases}\ ?$$ It's something like $$\int_\Omega \nabla u\nabla \varphi=\int_\Omega f\varphi+\int_{\partial \Omega }g\varphi,$$ but where do I take $\varphi$ ? In $H_0^1(\Omega )$ ? in $H^1(\Omega )$ ? In an other space ?
$\textbf{Q1)}$ When you have your weak formulation you can see in which spaces the functions $u$ and $\varphi$ should be. Because of the first integral we know that $\vec{grad}\,\varphi \in L^2(\Omega)$ and $\vec{grad}\,u\in L^2(\Omega)$ and also their trace $\gamma:u=u|_\Gamma \in L^2(\Omega)$ and $\gamma:\varphi=\varphi|_\Gamma \in L^2(\Omega)$. Therefore it suffices for $u$ and $\varphi$ to be both in $H^{1}(\Omega)$.
$\varphi$ can not be in $H^1_0(\Omega)$ because you have a robin boundary condition on $\partial\Omega$. This problem is well posed whatever $f$ and $g$ you choose. Think about one material with volume $\Omega$ and surface $\partial \Omega$ that has sinks and sourced of heat inside $\Omega$ given by $f$ and on its boundary $\partial \Omega$ there is a convective heat exchange that depends on the outer temperature $u_0$ given by $g$.
$\textbf{Q2)}$ The weak formulation you have presented is wrong. The correct one is the following: $$\int_\Omega{\vec{grad}\,u\cdot\vec{grad}\,\varphi\,dV}=\int_\Omega{f\varphi\,dV}+\int_{\partial\Omega}{\varphi\frac{\partial u}{\partial n}\,d\sigma}$$ In this case you can choose the function space for $\varphi$ to be $H^1_0(\Omega)$, because (Q1 also apply here for the spaces) you do not have any information about the fluxes on $\partial\Omega$ of $u$ (given by its normal derivative $\partial_nu$) and instead you have Dirichlet boundary conditions.
In this part you have compatibility conditions, because if you choose in your weak formulation $\varphi=1$ you must have: $$\int_\Omega{f\,dV}+\int_{\partial\Omega}{g\,d\sigma}=0$$ This can be explained as done before. Imagine sources or sinks in your material with volume $\Omega$ and surface $\partial\Omega$ and a prescribed temperature on its boundary $\partial\Omega$. If there is no equilibrium between the gererated (extracted) heat given by $\int_\Omega{f\,dV}$ and the integral of the boundary temperature $\int_{\partial\Omega}{g\,d\sigma}$ the material cannot be in thermal equilibrium and the problem would not be well posed and it should not be stationary. This can be better explained if we set $g=0$, where $f$ has to be a function of zero mean, what means that the generated heat must be equal to the extracted heat, as it is required for the time derivative $\partial_t u=0$