Why do some people get migraines and what can be done to avoid them?

Why do some people get migraines and what can be done to avoid them?