Do phone manufacturers like Samsung use AOSP as their base and customize that, or does Google provide a special vanilla version of Android and they customize that?
I worked with a couple of OEMs and know for a fact that when the OEMs start off working on a new version of android the Software Configuration team picks the latest stable version of the AOSP and then various teams start work to put their customizations in place. So say a Samsung will have the Touchwiz team start work to customize the UX. The Baseband team will route the Radio Interface layer to the proprietary RIL or vendor-Ril as it is sometimes called. It takes months of effort to roll out phones with the latest software. And contect with google minimal. Google does a compatibilty test suite (for new handset launches) upon failure of which Google proactively supports. Google also works very proactively with OEMs on the Nexus line of phones.
I worked at BlackBerry while they were developing the Priv, and we worked directly with AOSP plus some libraries provided by the chipset manufacturers. IIRC we also got a little bit of advance access to new versions, but nothing from Google that was developed specially for us or manufacturers in general.
Please note that this is based on my personal opinions/knowledge and I do not represent BlackBerry in any way.
Other than a few exceptions, such as OnePlus with CyanogenOS, most manufacturers use AOSP code for their base and customize it.