Palpitations can happen from anxiety, caffeine, dehydration, sleep deprivation, or sometimes a rhythm issue. Because the episodes are brief and you drink a lot of caffeine, the first step is to reduce stimulants and track when the episodes happen. If the palpitations become frequent, last longer, or come with fainting, chest pain, or breathlessness, you should get an ECG and a proper cardiology review.