Why is the sea salty?
Rain slowly dissolves tiny amounts of salt out of rocks, and rivers carry it to the sea. When seawater evaporates, the water leaves but the salt stays, so over millions of years the sea has built up its saltiness.

Why tho? Three levels deeper
Why don't rivers taste salty?
They carry very little salt at any moment, far too little to taste. The sea collects it from thousands of rivers over millions of years, while evaporation keeps taking pure water away.
Then why doesn't the sea get saltier forever?
Salt also leaves the sea: it settles into seafloor sediments and rocks and reacts at the seafloor. Over long times what comes in and what leaves roughly balance, so the saltiness stays about the same.
Does all the salt come from rocks?
Not all of it. The sodium comes mostly from rocks worn down on land, but much of the chloride came from gases released by volcanoes and from hot vents on the ocean floor.
A slow, endless cycle
Water goes round and round (sea, clouds, rain, rivers, sea), but salt only goes one way: into the sea. Evaporation is like a filter that lets the water out and keeps the salt in.
How salty is it?
On average, seawater is about 3.5% salt: roughly a teaspoon in a glass of water. Seas with little rain and lots of evaporation, like the Red Sea, are saltier.
Not just table salt
Sea salt is mostly sodium chloride, with magnesium, sulfate, calcium and potassium too.
Check yourself
If you let a glass of seawater dry in the sun, what's left?
Answer
Salt crystals: about 35 grams for every litre of seawater.