Accounting for the set of a current is not only important for reaching your destination efficiently, but it involves safety issues too. Most saltwater areas experience at least some degree of tidal current, which can exceed 5 knots or more in extreme areas. Rivers obviously have currents, but so do many harbors and lakes into which rivers pour.
Being aware of a current and knowing how to compensate for it helps you calculate the best course to steer and to calculate how long it will take to get there. This is particularly important in this era of GPS chartplotters, which often do not take current into consideration when route planning.
Finally, compensating for a current can be critical for safety in situations where the current sweeps you (perhaps unknowingly) off course into potential underwater obstructions.
How Current Can Affect You
It is easy to understand the effects of a current that is either directly with or against your direction of travel. If you are sailing at 5 knots with 1 knot of current with you, your direction doesn't change, but your speed over the ground (SOG), also known as velocity made good, is actually 6 knots. Conversely, if the 1-knot current is directly against you, your SOG decreases to 4 knots. In either case, your boat's knotmeter may show 5 knots (through the water), but your GPS will show the speed over the ground.
The effects of a current from the side are usually somewhat more difficult to calculate. Imagine that you are sailing at 5 knots to a point 5 nautical miles ahead. Without a current, you steer directly at that point (or compensate slightly for the effect of leeway when sailing), and you arrive there in 1 hour. But if there is a current directly from the side of 1 knot, and you steer the original compass heading for your destination, after 1 hour you will arrive at a point a mile to side of your intended destination. To compensate, you should instead have sailed to a destination calculated as 1 mile to the up-current direction of your destination, and during the hour of sailing, you will be swept that 1 mile back in the right direction.
But currents are seldom perfectly with, against, or at a right angle to your intended direction, and therefore it's important to be able to compensate for a current from any direction.
How to Know If There Is a Current
First, look around! Observe floating navigational aids, lobster or crab pots, or other objects. Usually you can see the current flowing past them and tugging them in its direction. With experience, you can learn to estimate the current's speed fairly accurately.
For a more accurate estimate of current, use a tide and current app, which are available for almost all US areas as well as many other waters around the world. They are available for both Apple and Android devices.
Perhaps most important for safety reasons, keep an eye behind you as well to check for a current set in your course. Many boaters have run aground when steering straight from one navigational marker to another, assuming they were in the channel, when actually a side current was sweeping them out of the channel - which they couldn't see when looking only straight ahead. When you look back, imagine a line from the last marker to the one ahead, and usually you can see if the boat has moved outside that line.
Finally, if you're really curious about a possible current but have no other means to detect it, stop the boat long enough that it is no longer passing through the water. (Spit overboard and watch the bubbles if you can't otherwise tell.) Then check your GPS for speed and heading to determine if the boat is still moving (along with the "still" water) and if so in what direction. This method does not work very accurately if the boat may be being blown in any direction by significant wind.
Compensating for Set of Current
As in the example above, once you know the strength and direction of a current, you may be able simply to do the math in your head. But if the current is from the side at some angle other than 90 degrees, this will be more difficult. Since most boaters these days use GPS, it is easier to take advantage of it to compensate for current. Set a waypoint for your destination. If you are in open water and not at risk of hitting any obstruction, simply steer to that waypoint (your "bearing") - regardless of the direction you actually point your bow (the compass "heading"). The difference between your bearing and your heading is due to the set of current, which in this case can actually be ignored except in calculations of how long it will take you to get there.
Note that most GPS units use the term "heading" to refer to the direction in which the boat is actually moving over the bottom. "Bearing" remains the direction to your destination. Some GPS units use the term "cross-track error" to refer to a discrepancy between the two.
If there may be obstructions to either side of your intended route, making it important not to be swept to the side as you sail the GPS bearing, then your best form of compensation is to set two (or more) waypoints, from start to destination. Use the GPS charting function to set a route line, which a chartplotter shows as a straight line between those points. Then you can simply steer the boat to keep it positioned on that line at all times. You don't need to follow a compass course or steer for a determined bearing or mentally calculate for current set at all: you just need to stay on the line.
A final consideration when sailing is figuring the effect of current when tacking to a destination upwind. Say, for example, that your destination is directly upwind. Without a current, you might tack to one side for a given time, and then to the other side the same length of time, and you would then be on the line directly from start to finish. But if a current sets you to one side, then one tack should be longer than the other. To compensate, set a route as mentioned above, and plan your tacks based on your changing bearing to the waypoint, not the original heading as you might have otherwise.