Some notes before trying either of the following options
Option 0 will increase build times even with --incremental and really option 1 should likely be used in most instances, however, this along with the extra space taken up maybe worth the costs if you're deploying on a network with clients that may not have access to CDNs.
Both options have been tested on a private server with kramdown as the markdown interpreter and mathjax: true set within the project's _config.yml file; see Step 2 of Soham Bhattacharyya's answer and their preface, and upto Caramdir's first two code blocks for the how-to for those bits.
Option 0 download and copy the unpacked source to project-name
Download the source
cd ~
mkdir -p git/hub && cd git/hub
git clone --depth 1 https://github.com/mathjax/MathJax.git
Make a directory path in your project's and copy files from MathJax/unpacked to this path
cd ~
mkdir -p git/lan/project-name/assets/JS_3rd_Party/MathJax
cp -r git/hub/MathJax/unpacked/* git/lan/project-name/assets/JS_3rd_Party/MathJax/
Add the source to git tracking
cd git/lan/project-name/
git add assets/JS_3rd_Party/MathJax
git commit -m 'Added MathJax.js unpacked source to git tracking'
Write an include file
tee ./_includes/MathJax.html 1>/dev/null <
{%- if jekyll.environment == 'production' and site.mathjax == true -%}
{%- elsif jekyll.environment != 'production' and site.mathjax == true -%}
{%- endif -%}
EOF
Private server builds will use MathJax.js where as production environment (GitHub) will use latest.js using the above Liquid if...elsif...endif statement.
Write a post to test it
tee ./_posts/$(date +'%Y-%d-%m')-math-tests.markdown 1>/dev/null <
---
layout: post
title: "Math Tests"
date: $(date +'%Y-%d-%m %H:%M:%S %z')
categories: math
---
{%- include MathJax.html -%}
for $x,y,z \in \{1, 2,\dots 9\}$
$$
\sum_{i=1}^n X_n
$$
EOF
I've not tried it without s because cboettig's suggestion seems to totally do the trick.
Additionally that extra new-line within spans are no mistake, without'em there where still issues with rendered output.
Add these latest files to git tracking
git add _posts/$(date +'%Y-%d-')math-tests.markdown
git add _includes/MathJax.html
Build locally, or push and build on a remote server
bundle exec jekyll build --destination /tmp/www/project-name --config _config.yml --incremental
Option 1 copy just latest.js to use a CDN (Content Delivery Network)
See Option 0 step 1.
Make a directory path for third party JavaScripts and copy MathJax/unpacked/latest.js there
cd ~
mkdir -p git/lan/project-name/assets/JS_3rd_Party/MathJax
cp git/hub/MathJax/unpacked/latest.js git/lan/project-name/assets/JS_3rd_Party/MathJax/
Write an include file
cd git/lan/project-name
tee ./_includes/MathJax.html 1>/dev/null <
EOF
See Option 0 Step 5.
Add these three files to git tracking
git add _includes/MathJax.html
git add _posts/$(date +'%Y-%d-')math-tests.markdown
git add assets/JS_3rd_Party/MathJax
git commit -m 'Added `MathJax.html`, `latest.js`, and a test post to git tracking'
See Option 0 Step 7. for building locally
For either of the options
If deploying on a private server you may also need to define baseurl within your project's _config.yml file, especially if emulating the username.tld/project-name URL scheme that GitHub uses on your private server.
If deploying to both a private server and GitHub it may be better to use a separate config file and when building issue --config _config.yml,_config_baseurl.yml, eg...
# Write the special config file
tee ./_config_baseurl.yml 1>/dev/null <
baseurl: "project-name"
EOF
# Build with extra config
bundle exec jekyll build --destination /tmp/www/project-name --config _config.yml,_config_baseurl.yml --incremental
Hope that helps with loading assets via an include.