Disclaimer: I'm not in the US. But I'm bored and I think I'm reading the numbers correctly.
In 2017 you earned 29'615. The standard deduction in that year was 6'350, personal exemption was 4'050. The taxable income comes down to 19'215. Of that, you owed 10% of the first 9'325, plus 15% of the rest. Which is 933 + 1'484 = 2417. Your employer withheld from your paychecks 3'256, which is 839 too much, and which you were refunded.
In 2018 you earned 36'892. The 2017 tax reform increased standard deduction to 12'000 and eliminated personal exemption. The taxable income was 24'892.
Of that you owed 10% of the first 9'525, plus 12% of the rest. Which is 953 + 1'844 = 2'797. 3'386 was withheld, which is 589 too much, and which you were refunded.
In both cases the few dollars difference in my calculations probably comes from rounding errors, but otherwise everything looks correct.
Each time you get a refund, it means that too much taxes were withheld. This usually means that the employer assumes that you earn a certain amount in a year, calculates taxes owed, and deducts 1/12 of this amount from the monthly paycheck towards taxes. If the assumption is in any way off the mark, because e.g. there was a period in the year when you weren't employed, or were employed elsewhere, which made you make less in a year than the assumed amount, you end up with too much taxes withheld and get a refund. The particular reason is hard to guess without knowing the specifics of your situation, or being familiar with what exactly goes into calculating the projected earnings.
If you managed to earn exactly the assumed amount, you'd get no refund, because the taxes withheld over the year would be exactly what you'd end up owing.
If you somehow managed to earn more, you'd have to pay extra taxes when filling the tax return.
But employers universally assume the highest possible earnings (I don't know, maybe that's the law), so that employees don't have to deal with a large lump sum to pay come the end of the fiscal year. Instead, the employees tend to pay a bit too much in taxes each month (or week, or whatever), and then get a refund.What I'm saying is, ask yourself what could be the reason your employer(s) in both 2017 and 2018 could be making inaccurate predictions, and why the prediction became more accurate in 2018.
Myself, I'm familiar with my personal situation, and know exactly why the refunded amount I get was overtaxed. But maybe the tax code around here is more transparent than in the US, I don't know.