Y DNA is only passed from father to son. Test results only identify potential common male ancestors and tests should only be taken by males. Ancestry.com no longer offers this test. Y DNA tests are available with Family Tree DNA.
The most common use of Y DNA testing will identify whether 2 males are related within 10 generations. The more markers that are tested (and more costly) will usually provide more detailed results. 12 and 25 marker tests usually will not provide very meaningful tests. A minimum of 37 markers is recommended with 45, 67, or 111 being better.
All males with the same last name are not all related. Why you ask:
1- When surnames started being adopted, many unrelated males chose the same last name. The origin of names is a subject for another time and place.
2- Other reasons are name changes, adoptions, males born out of wedlock and don't have the father's last name, and etc.
99.9% of Y DNA does not change.
0.09 % of the Y DNA typically only changes once in a family line. This portion of the Y DNA can be used to identify whether two males may have a common male ancestor. The test results are divided into groups known as Haplogroups.
0.01% of Y DNA may change slightly from generation to generation and can vary slightly between male siblings. This portion of the Y DNA can be used to identify the degree of relationships between two males. The test results can be further divided into haplogroup subgroups.
Sam Casey Jr. has taken the Y DNA results with ancestry.com and his paternal haplogroup is identified as R1b. Most people with the majority of ancestors from England, Scotland, and Ireland fall into Haplogroup R1b. No meaningful matches were identified in the ancestry.com data base.
Sam's Y DNA results were manually added to the Family Tree database. Again no meaningful DNA matches were identified.
According to the Casey Surname DNA project (see link), Sam's DNA results fall into a very common type of DNA grouping. All Casey males who fall into this grouping are not necessarily related to each other. People in this grouping MAY have a common ancestor around 600 years ago when Caseys first started using surnames, but the may not.
The Casey Surname DNA project recommends some further testing which may or may not be pursued.