There are several reasons why a cat might run around frantically:
1. This is a natural instinct to hunt prey. Many cats retain some of these instincts even after being domesticated. When they see something moving or a small insect in the house, they can't help but chase it.
2. The cat may be dirty, which will make the cat feel uncomfortable, and this discomfort will cause the cat to run around frantically.
3. It's to expend the cat's excess energy. When the cat wakes up, it has nowhere to release its energy, so it runs around wildly. 
How to treat fleas in cats:
1. Regularly clean your cat, mainly by bathing and brushing its fur frequently.
2. At home, it is essential to maintain household hygiene, keep windows closed, and minimize the cat's outdoor activities.
3. Disinfect the places your cat usually likes to stay, especially the litter box and toys.
4. Regularly treat your cat for external parasites and use medication to get rid of fleas on your cat's body.
5. Take your cat out in the sun more often. Sunlight can not only repel fleas, but also supplement calcium.