Taking part in Eurovision is somehow a way to advertize your country at European level through music, especially when you are to perform in the grand final. I think that is what justifies why so many countries participate every year. The firm drive to win is shared by only a tiny percentage of contestants imo (due to costs mainly).
Each broadcaster has its own goal: qualification, top 10 or victory. Winning the contest draws of course lots of attention and is the perfect opportunity to highlight your touristic potential, both for people who'll attend Eurovision next year and others who might want to discover a country they never thought of. Hosting may not always be worth it financially, but it is a significant promotional means in the medium term.
Look at me for instance, I knew nothing of Slovenia before I started watching the contest back in 2009, I happened to love most of their entries since then and in 2014 I finally decided to visit this country
and I didn't regret it!