$$\int^b_af(x)dx=\lim_{n\rightarrow\infty} \sum^n_{k=1}f\left(a+k\cdot\frac{b-a}{n}\right)\left(\frac{b-a}{n}\right)$$
I am trying to apply this to $$\int_0^4 (4x+2) dx$$
In this scenario, what is $n$? is $n=4$?
$$\int^b_af(x)dx=\lim_{n\rightarrow\infty} \sum^n_{k=1}f\left(a+k\cdot\frac{b-a}{n}\right)\left(\frac{b-a}{n}\right)$$
I am trying to apply this to $$\int_0^4 (4x+2) dx$$
In this scenario, what is $n$? is $n=4$?
$n$ is not $4$. $n$ is not fixed. You see the limit definition: that means you must consider the quantity, the Riemann (partial) sum, for every $n$ and (if this sequence has a limit) find its limit.
So, for some $n\ge1$, we calculate: $$\sum_{k=1}^nf\left(a+k\frac{b-a}{n}\right)\frac{b-a}{n}=\sum_{k=1}^n\left(4\left(0+k\frac{4-0}{n}\right)+2\right)\frac{4-0}{n}$$You should go from here. Calculate this sum exactly (this is possible) and then let $n\to\infty$.
You should use: $$\sum_{k=1}^n k=\frac{n(n+1)}{2}$$
Just use the definition what you posted.