Image source: California Environmental Protection Agency.

When it comes to investing in energy companies, there is something about oil and gas production that just seems to tug at the American spirit -- that idea of a wildcatter scouring the nation for that next big reservoir. Refining just doesn't seem to have that appeal. Perhaps that's why the sector doesn't get as much attention as the other parts of the industry. That's probably OK for those who do invest in it, though: The less attention it gets, the more impressive the returns for investors in the know.

To help you better understand the industry, here's a quick look at what you need to know about investing in this space, as well as a couple of stocks to watch in the refining industry: HollyFrontier (HFC) and Northern Tier Energy (NYSE: NTI).

What to look for
Researching refinery stocks can be difficult. As an industry, it is the middleman between two commodity markets: crude oil and refined petroleum products. Unlike other middlemen like pipeline companies, which can charge a fixed amount for transporting oil and gas in their systems, refiners are normally stuck with the profits that can be eked out from the difference in crude prices and refined product costs. Ultimately, this means that any refiner company depends largely on its operational efficiency and optionality. These two things can more or less be determined if you look at these four factors for refining stocks.

If you play your cards right, companies within this space can be very lucrative investments over the long term due in large part to their ability to generate excess cash flow and return it to shareholders through either dividends or share repurchases. 

That said, here are two companies that are probably worth watching in the refining space:

HollyFrontier
While HollyFrontier has only been around for a couple of years as a single entity, the two companies from which it came have been in the refining business for decades.

If there is something that HollyFrontier has displayed over the past several years, it's that management at the company has been both a disciplined and an opportunistic capital allocator. During down times in the commodity cycle, the company's management found opportunities to purchase refineries from peers, while adeptly investing money to make its facilities more efficient by either adding complexity to its refineries to turn cheaper crudes into premium products or investing in infrastructure to get a wider range of crudes to its facilities.

This disciplined capital approach has also allowed the company to generate loads of free cash flow, which it has generously handed out to shareholders in the form of both regular and special dividends in its past. These large payouts were part of the reason HollyFroniter and its predecessors have been able to produce total returns -- share price appreciation and dividends -- well above those of the broader market over the past 15 years.

^SPXTR Chart

^SPXTR data by YCharts.

As with any other investment, there are no guarantees that the company will be able to replicate this sort of success in the future. However, as long as management maintains its focus on disciplined investment and its generosity to shareholders through dividends, its chances are good.

Northern Tier Energy
Sometimes a company doesn't need to be the biggest player out there to be a decent investment as long as it carries a few favorable traits that allow it to perform well. This is the modus operandi of Northern Tier Energy. It only owns one refinery that processes fewer than 100,000 barrels of crude oil per day, but thanks to its location in the Minneapolis/St.Paul metro area, it has access to two types of crude that normally sell at a discount to other types of crude: Canadian oil sands, and Bakken crude from the North Dakota region.

Normally, these crudes have to travel several hundred extra miles to get to a refinery that can handle them, so Northern Tier can pay a little less than others as transportation costs to its refinery are quite a bit less. 

On top of that, the company has a pretty decent reputation as an efficient operator. It consistently runs its facility at a high utilization rate, and has some of the lowest operational costs per barrel in the business. These have allowed Northern Tier to generate some of the best returns on capital in the business, and its variable rate MLP structure can provide some very positive distribution yields when the commodity markets are right.

Investors in Northern Tier need to accept that distributions can decrease when times get tough or when maintenance issues at its only facility arise, but its reputation as an operator should help to ease some of those concerns.

What a Fool believes
If you know what to look for, refining stocks can be a very lucrative investment. They don't take nearly as much capital as other parts of the oil and gas space to maintain current production levels, and refining companies with disciplined management can generate loads of free cash flow, paying it back to shareholders in the form of generous dividends. HollyFrontier and Northern Tier Energy have shown these traits in some form or another, and investors should put these two companies on their stocks-to-watch list.