Consider the function:
$f_h(x) = \left\{\begin{array}{lr} h-(2+2h)x+6x^2 & x \in [0,1]\\ 0 & otherwise \end{array}\right\}$
Now, I have to determine one value for $h$ such that $f_h(x)$ becomes a probability density function. Here, I try to solve the integral for the constant $h$ knowing that the pdf should equal to $1$.
$$\begin{align*} & 1= \int_{0}^{1} h-(2+2h)x+6x^2 dx \\ &= \int_{0}^{1} h dx - (2+2h)\int_{0}^{1}x dx + 6\int_{0}^{1} x^2 dx \\ &= h - (2+2h)\frac{1}{2} + 6\frac{1}{3} \\ &= h - (1 + h) + 2\end{align*}$$
This is true for all $h$ as both sides are equal. Does this mean I can freely chose what value $h$ has?
Next, I have to determine the probability of the event $[-\frac{1}{2}, \frac{1}{2}]$ for all suitable $h$. My approach would be to calculate the same integral with the bounds of $0$ and $\frac{1}{2}$ (the pdf is $0$ in the interval of $[-\frac{1}{2},0]$). Can I ignore $h$ and simply put $h = 0$?
No, you cannot ignore $h$. While this is a valid pdf for all $h$ and the integral from $0$ to $1$ does not depend upon $h$, the integral from $0$ to $\frac{1}{2}$ does depend upon $h$. Taking the upper bound on your integral to be $\frac{1}{2}$ rather than $1$ gives $\frac{1}{2}h+ \frac{1}{8}(2+ 2h)+ \frac{1}{8}(2)= \frac{h}{2}+ \frac{1}{4}+ \frac{h}{4}+ \frac{1}{4}= \frac{3h+ 2}{4}$.