how do I learn an opening


Don't listen to the people that say that Ruy Lopes is to complicated for you. It is not. It is a logical opening suited for beginners to World Champions.
You will learn it like you will learn everyting else in your life: step by step. And not by hearth but by understanding.
So begin by understanding the first basic moves: White play 1.e4 to gain space in the centre (d5) and development (Bishop at f1 can now move). Every opening is about the centre and piece development. Black answer with 1...e5 with similar ideas.
But the pawn at e5 is not protected. So White plays 2.Nf3, hitting space in the centre (d4 and e5), developing the Knight and threatening to take the pawn at e5. Black plays 2...Nc6, hitting the same space in the centre (d4 and e5), developing the Knight and defending the pawn at e5.
White play 3.Bb5 developing the Bishop and threatening to take on c6 removing the protector of e5 and maybe take on e5.
That is all you need for a beginning. Now play som games. Analyse them - especially your losses. What do the people you meet play as Black in their third move? What would you play yourself? Then you have your first critical variations. Next thep: what do you as White like play in these variations. Take notes!
You may rely on books and lessons, but you don't need them. Just use your own understanding of the game. And for all sake: don't rely on engine evaluations. They are not relevant at your level, and they will hinder your learning and development.
And then back to playing and analysing. And finding new critical variations. Etc. It is fun!

I agree with Toldsted! I have been playing the ruy lopez since I was 1000 (or at least a beginner, I didn't want to go through the database to check) and it is very logical to play, and will win you some games out of the opening as a beginner! Since no one plays against it, you often win at least a pawn and then you get to learn how to win positions with initiative and material advantage. That being said, often learning openings can be as simple as learning the first couple moves, learning some typical plans/manoeuvres, and mainly learning pawn structures! I believe this is the best way to improve, as by studying ruy lopez structures (or 1.d4 structures - hanging pawns, isolated pawn, benoni structure, rauzer, KID, etc.) you stand to be better than your opponents due to experience in a type of position. Then, once you start losing games out of the opening, you should start learning about concrete opening lines to supplement that knowledge. Happy studying!