Troubles understanding the independence of events I have troubles to understand when an event is independent and when not. So I don't understand one step in the solution to this exercise:

We have $X,X_1,X_2,\dots$ be i.i.i. real random variable with density $f(x)$ and distribution function $F(x)$. Further $k\in \mathbb{N}$ and $t\in\mathbb{R}$ and 
  $$N:=\inf\{k\in\mathbb{N}:X_k>X\}$$
  Show $$P(N=k,X\leq t)=\int_{-\infty}^t F(x)^{k-1}(1-F(x))f(x) \, \mathrm{d}x$$

Then the solution says this:

By the definition of $N$ and independence of $(X,X_1,\dots,X_k)$ we have
  $$P(N=k,X\leq t)=P(X_1,\dots,X_{k-1}\leq X,X_k>X,X\leq t) \\ \underbrace{=}_{(*)} \int_{-\infty}^t P(X_1,\dots,X_{k-1}\leq X,X_k>X)f(x) \, \mathrm{d}x = \int_{-\infty}^t F(x)^{k-1}(1-F(x))f(x) \, \mathrm{d}x$$

Does this imply that $\{X_1,\dots,X_{k-1}\leq X,X_k>X\}$ is independent of $\{X<t\}$ or why can I write the integral after $(*)$ like that? Both events have the random variable $X$, so both events should be dependent?
Why can I write the event $\{X<t\}$ as an integral and the other event stays in $P(X_1\dots)$ form?
My second question is about $N$. $N$ is clearly dependent on $X_1,\dots,X_k$ but is it also dependent on $X$?
Thank you for explanation.

The second equality is not quite right and should read
$$
P(X_1,\ldots,X_{k-1}\leq X,X_k>X,X\leq t)=\int_{-\infty}^t P(X_1,\ldots,X_{k-1}\leq x,X_k>x)f(x)\,\mathrm dx.
$$
To realize this, note that we may write the probability as an iterated integral
$$
\begin{align}
\mathrm{E}[\mathbf{1}_{X_1,\ldots,X_{k-1}\leq X}\mathbf{1}_{X_k>X}\mathbf{1}_{X\leq t}]&=\int_{\mathbb{R}^{k+1}} \mathbf{1}_{x_1,\ldots,x_{k-1}\leq x}\mathbf{1}_{x_k>x}\mathbf{1}_{x\leq t}\,P_{(X,X_1,\ldots,X_k)}(\mathrm dx,\mathrm dx_1,\ldots,\mathrm dx_k)\\
&=\int_{\mathbb{R}}\int_{\mathbb{R}^k}\mathbf{1}_{x_1,\ldots,x_{k-1}\leq x}\mathbf{1}_{x_k>x}\mathbf{1}_{x\leq t}\,P_{(X_1,\ldots,X_k)}(\mathrm dx_1,\ldots,\mathrm dx_k)\,P_X(\mathrm dx)\\
&=\int_{-\infty}^t\int_{\mathbb{R}^k}\mathbf{1}_{x_1,\ldots,x_{k-1}\leq x}\mathbf{1}_{x_k>x}\,P_{(X_1,\ldots,X_k)}(\mathrm dx_1,\ldots,\mathrm dx_k)\,f(x)\mathrm dx
\end{align}
$$
where we have used that $P_{(X,X_1,\ldots,X_k)}=P_X\otimes P_{(X_1,\ldots,X_k)}$ by independence as well as Tonelli's theorem. 
The innermost integrals is seen to equal $P(X_1,\ldots,X_{k-1}\leq x,X_k>x)$.
