Is the attack "Flail" of Magikarp worth it?
Flail can be, potentially, the most powerful move of Gyarados.
It's a bit risky, because your Gyarados will need to have less than 35% of its HP to "generate" a powerful Flail.
Also you need to have a good speed to ensure to be the first to hit each turn. Gyarados has a discrete 81 Base Speed value, so it can be "outspeeded" from a faster enemy.
In short, the more powerful is the move, the more fragile is your pokemon. It's up to you.
To answer your second question: no, your Gyarados' stats will be the same regardless the level you evolve it. They only depend on EVs, IVs, base stats, nature and level of your pokemon, and the only things that change with evolution are base stats.
PS:
That's not true that if you didn't evolve Magikarp until level 30 you'd be missing out other moves which Gyarados would learn, because you can always teach them with the Move Reminder.
No. Flail is not worth it. Gyarados learns much more powerful moves between levels 20 and 30, totally invalidating Flail.
To expand slightly, if you didn't evolve Magikarp until level 30, you'd be missing out on the following moves which Gyarados would learn:
- lvl 20 - Bite (a physical dark attack which may cause flinching)
- lvl 23 - Dragon Rage (a special dragon attack which always does 40 damage, regardless of effectiveness)
- lvl 26 - Leer (a status move which lowers the opponent's defense)
- lvl 29 - Twister (a special dragon move which may cause flinching)
The formulae for determining stats of a pokemon do not depend at all on which stage of their evolution they are at the time of each levelup, but instead on the following factors:
Effort Values (invisible stat gained when defeating enemies based on what enemy it is. gain between 1 and 4 EV per kill in predetermined stats. example: kill many geodudes and your def will go up)
Individual Values (invisible stat determined at the time you first meet/catch your pokemon, ranging from 0 to 31, denotes the idea that some pokemon are just better than others)
Level (current level of the pokemon)
Base Stats (how good a pokemon is in regards to each specific stat, consistent across all pokemon of that species, for example Garchomp has a base attack of 130, but a base special attack of 80, so you should be teaching him physical attacks)
Nature (the pokemon's personality. increases one stat but lowers another)
You can find the exact formulae for how particular stats are calculated at http://bulbapedia.bulbagarden.net/wiki/Stats (in particular go to the section for gen3+ as the formulae for gen1/2 are out of date since the inclusion of natures)