Several factors determine how you go about this.
- Your style of play
- Your available resources
- How much time you are willing to invest
1. Your Style of Play
If you are more comfortable playing strategically/positionally than tactically, you will tend to prefer openings like the Colle System, London System, Queen's Indian Defense, French Defense and Hedgehog Defense. If you prefer tactical play, then the Sicilian, King's Gambit (or almost all gambits, for that matter), King's Indian Defense, Gruenfeld Defense, Scandinavian and Alekhine's Defense are good candidates.
Your choice of opening dictates whether or not you need to know a lot of theory. In the tactical openings, you need much more theory, because they abound with traps and frequently-occurring combinations that are known to theory (and therefore your opponents). This means that learning to play the Sicilian Defense, where theory goes nearly to move 30 in many of the lines, will be much more work and require more time practicing them.
2. Your Available Resources
If you can afford (or already have) both chess software and a ChessBase or Chess Assistant version of a database of games, that's a huge help (some would say indispensable). Then, you need a decent introductory book, preferably in digital format. I strongly recommend digital because it's an enormous time-saver when learning a line for the first time; you can review as many times as you want with no (board) setup effort, you can skip to hotspots easily, you can investigate quickly with a database search or an engine, etc.
The best methods involve finding the ideas in the opening. You can get this information a couple of ways, and I would recommend trying them in sequence:
Read an overview of the opening that explains the ideas.
Read and practice the lines in an introductory but more detailed theory book, such as one from the Everyman Publishing series "Starting Out: ...".
Pick out some games (30-50) from a database where the player of your color was rated about 2100-2300 ELO. Try to find games they won, where their opponent was rated at least 50 ELO lower. These games will show you how the opening is handled when the opposition doesn't handle it well. Play through them quickly, and try to find recurring ideas. Tag these, as well as any others you find interesting ideas in. Then, play through the tagged games more slowly, and see if you can understand each move by your color. When you don't, switch on an engine, and try some ideas for alternative moves to see what happens. That should reveal why the move was correct in most cases. Mark any that are still unclear to explore later. Take notes in the games themselves.
Once you understand the ideas, pick out more games, this time among players rated 2400+, and watch how the opposite color handles the problems faced by the weaker players in the first set of games.
Finally, settle on your repertoire for this opening. Run through the opening with an opening book, or by using a large database as a reference, and find the most common lines in each position for the lines you want to study. Record the lines that are most common (don't study any move that occurs less than 10% of the time in a given position), indicating your choice at each position where your color has multiple options. Pick only one move to learn; put the others aside. If you can determine the win rate (an opening book or reference db will show this) for each move, this may be easy, but sometimes it's a matter of preference for the kinds of positions that arise, or an exchange that is arranged or avoided, etc.
With your repertoire now both understood and recorded, figure out a way to train yourself in it. Many players use either Chess Position Trainer or Chess Openings Wizard. CPT accepts a PGN import of games in your repertoire, and will prompt you to find the repertoire move for each one of a set of positions that it presents you. It will schedule repetition of each exercise according to whether you recalled the move correctly or not; soon if not, after a few days if so. This makes training much more efficient than simply repeating all the moves in a line every time.
Also, CPT throws positions at you without replaying lines. Once you learn to respond to the position, you won't be surprised when your opponent transposes to a different line or even a completely different opening.
To learn to play the lines well, however, nothing can replace playing them in rated games. The closest you can come to it is moving the pieces for both sides on a board; don't try to jump straight from digital to a tournament game. The visualization and recall processes are not the same, and a familiar position on a screen often looks completely new on a board. So, learn it digitally, practice it on a board, then play it in games (online is convenient, but not a complete substitute for OTB play if that's your ultimate goal; do both).
3. How Much Time You Are Willing to Invest
If you can afford to study chess an hour a day, then you can afford about 2-3 hours a week on openings; you should spend the remaining time on other topics, including 1) playing, 2) tactics, 3) strategy, and 4) endgames. The average intermediate player (under 1850 or so) spends way too much time on openings for it to be beneficial to their rating/quality of play. I've played with a number of 2000+ players who don't know the names of some of the common variations, let alone how to play them. If they can get to 2000 without that kind of knowledge, then so can you.
If you can only spend 2-3 hours a week, then stick to some core openings: 1 for White, and 2 for Black (1.e4 and 1.d4). Choose a less tactical opening for each, for the reasons given above.
If you have a bit more time than that, I recommend starting to study a more tactical opening, but where the theory is fairly stable and not excessively deep. The Scotch Opening for White is a decent candidate, as is the Scandinavian for Black against 1.e4. Keep learning and practicing the new opening without playing it seriously until you're confident in your ability to follow all the main lines. Then, introduce it gradually. Many players use "extra openings time" to learn a different opening for blitz, or a surprise opening for opponents they expect to meet more than once in several tournaments.
If you have lots of time, by all means tackle one or more of the Big Ones, i.e. the Ruy Lopez, Sicilian, Two Knights Defense, Queen's Gambit, etc. You'll lose for awhile, but then you'll get enough experience to play them well. You should expect this to take at least 6 months against strong opposition, but it will pay dividends against weaker opponents.