Image source: GoPro.

Buying back shares is one of the ways companies can return cash to shareholders, but companies are generally very poor at timing the buyback of their own shares. Case in point: GoPro Inc (GPRO -0.56%), the action-camera maker, which bought back $35.6 million in shares during the fourth quarter of 2015 for an average $23.05 per share, only to see shares fall into single digits this year.

GPRO Chart

GPRO data by YCharts.

Most of GoPro's $300 million buyback program is still available today, and if management were bullish on the business, they could have bought back a lot of shares for a very low price. But GoPro has had bigger problems than its share count, and that leads to a case study on why companies don't buy back shares when they're cheap.

The buyback that never was

A $300 million buyback program was announced when third-quarter 2015 results were announced in October 2015, which, not coincidentally, was when investors learned that GoPro was going to have a terrible second half of the year. The stock plunged, and the company spent $35.6 million to buy back shares in the fourth quarter of 2015, but shares continued to fall in 2016 and the buybacks didn't continue.

According to earnings reports, shares outstanding have actually risen from 137.1 million at the end of 2015 to 138.9 million after the second quarter of 2016. That's the opposite of buying back shares. GoPro is slated to report third-quarter 2016 earnings on Thursday.

Why GoPro isn't buying back shares

One reason the buybacks aren't happening is because GoPro doesn't have a big pile of cash to spend. You can see below that cash on hand has been dwindling for a year, and with the holiday inventory buildout in full swing, there are cash needs elsewhere in the business. 

GPRO Cash and Equivalents (Quarterly) Chart

GPRO Cash and Equivalents (Quarterly) data by YCharts.

Some of the decline in cash was due to written-down inventory and equipment in the second half of 2015. And a significant chunk of money has been going to R&D to launch the Hero 5 camera and Karma drone.

R&D spending in the first half of this year jumped a whopping 58% from a year ago, to $170 million. That investment could pay off, but it took millions of dollars away from potential share buybacks. 

Companies rarely get buybacks right

It's hard to get share buybacks right for a variety of reasons, but one is that the stock is rarely at its lowest when cash on hand is high and profits are rolling in. Instead, the best time to buy back shares is usually when companies are struggling to generate cash to run the business and have the need to invest money elsewhere. That's exactly what's happening with GoPro right now. 

It's possible that management could see strong demand for Hero 5 and Karma in the third and fourth quarters and be buying back millions of dollars in shares, but that's not something investors should count on right now. The better bet is that they're spending money trying to get new products off the ground.

While that's the right priority for the business, it's a lost opportunity to buy back shares on the cheap -- especially if the Karma drone is a hit and GoPro becomes flush with cash once again.