Gambling
Most jurisdictions regulate gambling. Exactly what constitutes gambling (and how different types are regulated) varies by jurisdiction but the criteria usually turn on whether the outcome is primarily determined by luck or skill. If it is primarily luck based, it's gambling - if it's skill-based, it isn't.
What are the legal requirements of running a giveaway competition where people play for free but will win something?
The common name for such a competition is a sweepstake if entry is free, or a lottery if some kind of purchase is required or if the promotion is limited to, say, existing customers.
The legal requirements vary by jurisdiction - they may be freely allowed, require registration, or be prohibited. There might also be differences if the promoter is a for-profit business or a not-for-profit community organisation.
Also is a competition like a singing/ talent competition where there are judges (and people can win something) have the same legal requirements like a giveaway? If so, why? If not so, why?
No. As stated above, the outcome of these is driven primarily by skill, not luck. Also in this category are sporting competitions, game tournaments, colouring-in competitions etc.