Finding the weekday of a birth date works because the seven day cycle has run without interruption for well over a thousand years. Calendars have been reformed, months have lost days by decree, and years have been renumbered, but nobody ever inserted an eighth day into the week or skipped one. The Gregorian reform of 1582 removed ten dates from October, yet Thursday the 4th was followed by Friday the 15th: the dates jumped, the weekdays did not. That unbroken chain is what lets a calculator state, with total confidence, the weekday of any date in the past several centuries. There is a neat consequence for birthdays ending in the same digit: because of the drift, your 11th, 17th and 22nd birthdays tend to share your birth weekday, in a repeating pattern of gaps of five, six and eleven years that perpetual calendar enthusiasts know by heart.
You cannot get a birth weekday from the year alone, because the weekday of a fixed date drifts. A year is 52 weeks plus one day, so a date falls one weekday later each ordinary year, and two later after a leap year has passed. Your birthday this year is therefore rarely on your birth weekday; it returns in cycles of five, six or eleven years depending on how the leap days fall. People who share a birth date in different years usually have different birth weekdays, which surprises everyone who expects the calendar to repeat annually. Historical dates come with a caution: before the Gregorian reform reached a country, its recorded dates belong to the Julian calendar, and the weekday a modern calculator returns assumes the Gregorian rules extended backwards. For most family history purposes the difference is a curiosity, but for dates near a country's changeover it can matter.
The old rhyme beginning Monday's child is fair of face attached a fortune to each birth weekday, and versions of the idea exist in many cultures, from Thai colours of the day to naming traditions in Ghana where a child's name reflects their birth weekday. Whether or not you credit the folklore, the fact itself is worth having: it appears on some birth records, it settles family arguments, and it is the first thing most people check with a weekday finder, usually followed immediately by the birthdays of everyone else they know. If you want the fact for a certificate, a baby book or a gravestone, verify the birth date itself first. More birth weekday surprises turn out to be misremembered birth dates than calendar errors, especially for relatives born around midnight or around the New Year.