Ocean water is salty because it contains high concentrations of dissolved minerals known collectively as salts. Around 3.5% of ocean water is comprised of salts, depending on where in the world one is; equatorial waters tend to be saltier, while northern waters are slowly becoming more fresh. There are a number of factors which make the ocean salty, and scientists are very interested in the salt content of the ocean, because it contributes to the flow of currents through the ocean, in a process known as thermohaline circulation.
One of the reasons that the ocean is salty has to do with the ocean's floor, which contains a huge assortment of minerals and dissolved organic material which is slowly eroded and stirred up by the movements of the ocean. As the ocean eats away at the ocean floor, it increases the salt content. The ocean floor is also constantly renewing itself, another way to make the ocean salty, as seafloor spreading releases even more dissolved minerals into the water, in the form of emissions from hydrothermal vents and cracks in the seafloor.
Another thing that makes the ocean salty is the water runoff which pours into the ocean. This might seem counterintuitive to you, as rivers, streams, and lakes probably taste fresh to you. However, this water also contains dissolved salts, although the concentration is lower than that in the ocean. These salts make their way to the ocean with the river water, which eventually evaporates from the ocean to fall back to Earth again as rain, repeating the process.
The reason these salts do not build up in things like lakes is because inland bodies of water have an outlet. What makes the ocean salty is the slow concentration of salts over time, because the salts in the ocean have nowhere to go. Lakes and streams, on the other hand, are constantly recirculating their water. To find out what happens when a lake has no outlet, you can look at the Dead Sea, which has a famously high concentration of salts.
Now that you know what makes the ocean salty, you may be interested in experimenting with your own personal threshold for tasting salt. If you drink a glass of water out of the tap, you will probably perceive it as “fresh.” In fact, tap water has a number of dissolved salts, and these salts are what give tap water its flavor. If you don't think that water has flavor, try drinking a glass of distilled water, which will taste incredibly stale and flat by comparison. If you add a pinch of regular salt to distilled water, it will taste significantly more fresh; the same pinch added to fresh water may make it taste a bit salty to you.