How to convert sequences of images into state in DQN?
I want to know, since the input is given to a CNN, how would we encode these frames to serve as input to the CNN? 


As nbro mentioned in a comment to your answer, this question has very recently been asked and answered here.


  I also want to know since $s_1$ is equal to a set, which can be seen in line 4 of the algorithm, then why is $s_{t+1}$ equal to $s_t$, $a_t$, $x_{t+1}$?


The algorithm presented in the original DQN paper is relatively simple and written to express the main ideas of their approach (e.g. experience replay, preprocessing histories, gradient descent, etc.); in fact, it isn't even the exact algorithm used in the experiments! For example, the experiments use frame-skipping to reduce computation - this is not mentioned in Algorithm 1 in the paper. With that in mind, setting $s_{t+1}$ equal to $s_t, a_t, x_{t+1}$ in the algorithm signifies a general notion of constructing the next raw state $s_{t+1}$ from the previous preprocessed state $s_t$, previous action $a_t$, and current frame $x_{t+1}$. For example:


If the action space at the next timestep is constrained by the state, then the state may need additional parameters to encode the action space.
The algorithm needs some indication if a state is terminal, and such an indication may need to be encoded in the state.
If there is frame skipping, then multiple frames will be needed to construct the next state, possibly using the previous state as well.


The above examples should display how the encoding of the state cannot always simply be a stack of raw frames, or even a function of $s_t$, $a_t$ and $x_{t+1}$, and therefore a more general approach is often required.