An attack roll determines whether or not you hit an opponent (or any other target) with a weapon (be it a sword, a pistol, a thrown object or your bare hands).
Attack rolls are similar to checks: you roll 3d6 and add the relevant ability modifier. The abilities most often associated with attack rolls are Strength for most melee weapons), Dexterity (for finesse melee weapons and ranged weapons) and Wisdom (for missile ranged weapons). Many weapons let you choose between two abilities.
Like checks, attack rolls can have additional modifiers from feats or be affected by advantage and disadvantage depending on the circumstances. When you roll your attack with at least one instance of advantage, you are said to have Combat Advantage.
Unlike a check, instead of comparing the result of your attack roll to a DC, you compare it to your target’s Defense, which measures their ability to avoid attacks. If you equal or exceed your target’s Defense, your attack hits. Otherwise, you miss.
Despite their similarities, attack rolls are not checks, so you can’t take 7, 10 or 18.
If you are not proficient with the weapon you are attacking with, you have disadvantage on your attack roll.
Most intelligent creatures are proficient with basic weapons, and you can become proficient with any kind of weapon by selecting the appropriate feat.
When you hit, you usually roll for damage (unless the weapon has a different effect).
Instead, you roll the die (or dice) appropriate for the weapon you’re using (although your feats may add extra dice or change the die type), and add appropriate modifiers (which may include the ability modifier you used for the attack roll, a different one, or no ability modifier at all).
The total of the dice rolled plus the modifiers is the damage for your attack.
Most weapons also have a damage type. The actual damage may be reduced by your target’s armor, depending on it’s type.
When you roll a 18 in your attack (before adding any modifier), you score a critical hit and deal extra damage.
The damage roll uses twice the dice from the weapon you are using. Extra dice from special abilities isn’t doubled, and neither are any modifiers. Some feats, however, increase or add to the weapon’s base damage, and in those cases, that damage is multiplied.
Critical hits usually ignore the armor of the target, and deal their full damage, but some armors reduce all damage, even from critical hits.