How does the forget layer of an LSTM work?
Think of it like this: The cell state $h_t$ is a vector.  The forget vector $f_t$ is used to choose which parts of the cell state to "forget".  We update the hidden state with something like $c_t = f_t \circ c_{t-1}$ (it's actually more complicated, but let's start with that, to gain intuition).  Suppose $f_t$ were a vector of 0's and 1's.  In the coordinates where $f_t$ is 1, the value of $c_{t-1}$ would be copied over to $c_t$ (it's not forgotten).  In the coordinates where $f_t$ is 1, $c_t$ is reset to zero and the value of $c_{t-1}$ is ignored  (it's forgotten).  So, the forget vector can be used to control in which positions we forget values from the previous cell state vector.

Now what remains is to figure out a way to choose a forget vector $f_t$.  In general we might want to choose which positions to forget based on both the current input $x_t$ and the previous hidden state $h_{t-1}$.  So, we should compute $f_t$ as some function of $x_t$ and $h_{t-1}$.  Many choices of how to represent that function might be possible, but a LSTM chooses a specific function for this.  In a LSTM, this is done by a single-layer fully-connected neural network.  A single-layer fully-connected neural network concatenates all of the inputs, then multiplies them by a matrix, adds a bias, and feeds the result to an activation layer (in this case, sigmoid activation).  So that's why the formula for $f_t$ looks the way it does: that formula is capturing what a single-layer fully-connected neural network does.