How to improve king safety I really wish to improve my chess skills a bit, albeit I am pretty sure that I do not want to become a grandmaster.

One of my problem is my king's safety. Chess is very different from some other board games. E.g. in checkers you must either kill or immobilize every single opponent's pieces in order to win; however, the rule of mandatory capture repulses me quite a lot from playing draughts. Chess is much nicer, it's more elegant and has much more possibilities. But having your queen, rooks, bishops, knights and pawns in good squares, a good attacking position and knowing strategy and tactics, openings and endgames etc. is nothing if you are so, so bad at providing safety for your king.

In fact, I would say I'm quite good in endgames where pieces are so few. If I have a pawn or a piece advantage and manage to get to the endgame, then I can make my way to a win. But my opponent rarely allows me to play so many moves. The game ends in the opening or middlegame. That is, I'd like to say I've studied fool's mate, scholar's mate and so on. I know how to avoid them. Most often, the opponent checkmates me in the middlegame.

I've seen a couple of great chess games on youtube. For example, 1851 "immortal game" (Anderssen–Kieseritzky) impressed me so much. And of course, using my chessboard I studied (played back) quite a bunch of other famous games played by very good chess players. Many of them seem to have the same theme: the stronger player constantly gives checks and thus blocks a good majority of squares around the opponent's king. Then, he/she delivers checkmate, using a great advantage from those blocked squares.

I am not sure if I should keep my own king open or closed. An open (bare) king seems to be a bad thing since it is very easily separated from my pieces and then driven to the edge of the board. But isn't a king surrounded by friendly pieces from different sides even worse? They are used as an advantage by the opponent. Moreover, I am often checkmated with a knight, so it can be a smothered checkmate.

Unfortunately, my search for "king safety" on this site did not provide too much useful information.

The question is if they are any videos or maybe sites or written material which would help me to improve my king's safety? Apart from very obvious advice, e.g. an early castling. Believe me, I know my castling well.

When playing chess, I still try to concentrate on capturing enemy pieces and thus to make my way to the endgame. I know it can be criticized but it's my style.
It's a very general question, no concrete examples (where you struggle to defend) are provided in your post, and as such one cannot really answer meaningfully. However, here are some rough hints that might help you:

Pawn structure is a key factor in king safety. Any pawn move commitments on the side you've castled should be taken into account with extreme care, else you're irreversibly creating hooks for your opponents attacks or simply holes for the opponent's pieces to land on. E.g., when you castle short and play h3, when your opponent hasn't castled short, there's a very concrete attack threat on your king: black pushes the g and h pawns and opens a file towards your king, as g4 will challenge h3, and often however you react to it, a file will eventually open. Instead if all the pawns are on the starting squares, it's very hard for your opponent to find a breakthrough (for more on this see the discussions here and in particular the showcased Kasparov game). 


For a good example, see the game of Aronian vs Kramnik from 2018 candidates: notice how Kramnik exploited the h3 hook to create a devastasting attack on white's king.


Similarly argued, if you finachetto your bishop on a castled side (e.g. g3-Bg2), and lose/trade that bishop, all the weakened squares  turn into holes (entry points) for your opponent's pieces towards your king. 

Defending pieces: Another aspect to king safety is presence of defending pieces, e.g. if you castle short and all your minor pieces are on the queenside, your king's left naked and can be easily prone to various sacrificial attacks which you won't be in time to defend.

Here are some diagrams showing some typical examples:


Left:h3, a hook for your opponent's attack. 
Mid: Weakened Fianchetto structure. 
right: knights are great defenders.






Neutralize opponent's key attacking pieces: Given your established structure on the side you've castled, or simply where your king stands, ask yourself which of your opponent's pieces can best exploit these weaknesses against your king and try to force a trade of those pieces. And vice versa, try to preserve your good defenders by disallowing your opponent from easily forcing an exchange.

Play for initiative: Try to create threats and attacks to divert some of your opponent's play and pieces away from your king. If you pose no challenge to your opponent, they will simply mount everything they have onto your king. To play the defense side is always harder, as you have to consider all the tactical options for your opponent in order to defend against them, whereas for them, if a tactic works or not is not a major risk (unless they've sacrificed heavily of course) as either way it doesn't concern their king. 

Anyhow, the list goes on and this is by no means exhaustive, but it hopefully gives you additional hints for how to think about your king's safety.