What is the button in the upper right of windows? Some Mac applications have this button in the upper right. What is it called? Is there a keyboard shortcut for it?

In the case of MacVim, the button toggles the toolbar of colorful icons you see on the left. Saves some space on the screen. Is that what the button does in all applications?
Yes, it toggles the toolbar in all applications. In many applications, it's shortcut is Option+Command+T, but this is not true for all (Preview uses Command+B).